Course contentsShow
← Machine Learning and Deep Learning
Lesson 1294 of 3,53829. Core NLP TasksFree lesson

NER Evaluation Metrics

Measure NER performance with entity-level precision, recall, and F1, distinguishing exact vs partial boundary matches.

NER Evaluation Metrics

You'll learn: How to properly measure your NER model's performance using entity-level metrics that account for boundary precision.

Why Entity-Level Metrics Matter

When you predict named entities, it's not enough to just check token-by-token accuracy. An entity like "New York City" spans three tokens—if your model predicts "New York" as B-LOC I-LOC O, you've partially found the entity but missed its complete boundary. Standard token accuracy would give you 66% correct, but from an entity perspective, you've failed to extract the right entity.

Core NER Metrics

Precision: Of all entities your model predicted, how many were correct?

  • Formula: correct predictions / total predictions

Recall: Of all true entities in the data, how many did your model find?

  • Formula: correct predictions / total true entities

F1 Score: The harmonic mean balancing precision and recall.

  • Formula: 2 × (precision × recall) / (precision + recall)

Exact vs Partial Matching

Exact match: The predicted entity boundaries and type must match perfectly.

  • "New York City" [LOC] predicted as "New York City" [LOC] ✓
  • "New York City" [LOC] predicted as "New York" [LOC] ✗

Partial match: Some systems give partial credit when boundaries overlap, even if not exact. This is less common but useful for understanding model behavior during development.

Think of it like drawing boxes around words in a document. Exact match requires your box to perfectly align with the answer key—same start, same end, same label.

Key Takeaway: NER evaluation uses entity-level precision, recall, and F1 scores with exact boundary matching as the standard, ensuring your model correctly identifies complete entities, not just individual tokens.