0
0
NLPml~8 mins

Lemmatization in NLP - Model Metrics & Evaluation

Choose your learning style9 modes available
Metrics & Evaluation - Lemmatization
Which metric matters for Lemmatization and WHY

Lemmatization is about turning words into their base form, like "running" to "run". To check if a lemmatizer works well, we use accuracy. Accuracy here means how many words are correctly changed to their base form out of all words tested. This is important because a wrong base form can change the meaning and hurt later tasks like search or translation.

Confusion matrix for Lemmatization
          | Predicted Correct | Predicted Incorrect
    ------|-------------------|-------------------
    Actual Correct   |        TP = 85       |       FN = 15      
    Actual Incorrect |        FP = 10       |       TN = 90      

    Total words tested = 200

    TP: Words correctly lemmatized
    FN: Words that should be lemmatized but were not
    FP: Words incorrectly changed
    TN: Words correctly left unchanged
    
Precision vs Recall tradeoff in Lemmatization

Precision tells us: Of all words the model changed, how many were correct? High precision means fewer wrong changes.

Recall tells us: Of all words that needed changing, how many did the model catch? High recall means fewer missed changes.

For example, if a search engine uses lemmatization, high precision is important so it does not change words wrongly and confuse results. But if a language learning app uses it, high recall is important to catch all word forms and teach the base word.

Good vs Bad metric values for Lemmatization
  • Good: Accuracy above 90%, Precision and Recall both above 85%. This means most words are correctly lemmatized and few mistakes happen.
  • Bad: Accuracy below 70%, Precision or Recall below 60%. This means many words are wrongly changed or missed, hurting downstream tasks.
Common pitfalls in Lemmatization metrics
  • Accuracy paradox: If most words don't need changing, a model that never changes words can have high accuracy but be useless.
  • Data leakage: Testing on words seen during training inflates accuracy falsely.
  • Overfitting: Model works well on training words but fails on new words, showing high training accuracy but low real accuracy.
Self-check question

Your lemmatization model has 98% accuracy but only 12% recall on words that need changing. Is it good for production? Why or why not?

Answer: No, it is not good. The model misses most words that need lemmatization (low recall), so it fails to convert many words correctly. High accuracy here is misleading because most words don't need changing, so the model just leaves them alone.

Key Result
Accuracy, precision, and recall together show how well a lemmatizer correctly changes words without missing or wrongly changing them.