0
0
NLPml~8 mins

Why NER extracts structured information in NLP - Why Metrics Matter

Choose your learning style9 modes available
Metrics & Evaluation - Why NER extracts structured information
Which metric matters for this concept and WHY

For Named Entity Recognition (NER), the key metrics are Precision, Recall, and F1-score. These metrics tell us how well the model finds and labels entities correctly.

Precision shows how many of the entities the model found are actually correct. This matters because we want to avoid wrong information.

Recall shows how many of the real entities the model managed to find. This matters because missing important information can reduce usefulness.

F1-score balances precision and recall, giving a single number to understand overall quality.

Confusion matrix or equivalent visualization (ASCII)
    Entity Prediction Confusion Matrix:

                 Predicted Entity   Predicted Non-Entity
    Actual Entity        TP                 FN
    Actual Non-Entity    FP                 TN

    Where:
    TP = Correctly found entities
    FP = Wrongly labeled entities
    FN = Missed entities
    TN = Correctly ignored non-entities
    
Precision vs Recall tradeoff with concrete examples

If the NER model has high precision but low recall, it means it finds few entities but those are mostly correct. This is good if you want very reliable info but can miss many entities.

If the model has high recall but low precision, it finds most entities but also many wrong ones. This is good if missing entities is bad, but you must handle extra noise.

Example: In medical records, high recall is important to catch all diseases mentioned, even if some mistakes happen. In legal documents, high precision is important to avoid wrong facts.

What "good" vs "bad" metric values look like for this use case

Good NER model: Precision and recall both above 85%, F1-score above 85%. This means it finds most entities correctly and misses few.

Bad NER model: Precision or recall below 50%. This means many wrong entities or many missed entities, making the output unreliable.

Metrics pitfalls
  • Ignoring entity boundaries: Partial matches can inflate scores if not measured carefully.
  • Data leakage: If test data is too similar to training, metrics look better than real use.
  • Imbalanced entity types: Some entities appear more often, skewing overall metrics.
  • Overfitting: Very high training scores but low test scores mean the model memorizes instead of generalizing.
Self-check question

Your NER model has 98% accuracy but only 12% recall on person names. Is it good for production? Why not?

Answer: No, it is not good. Accuracy can be misleading because most words are not entities. The very low recall means the model misses almost all person names, which is critical information. So, despite high accuracy, the model fails to extract important structured information.

Key Result
Precision, recall, and F1-score are key to measure how well NER extracts correct and complete structured information.