liveBook · Manning

F-score

As explained in Natural Language Processing in Action, Second Edition

F1 score is the harmonic mean of precision and recall for a classification or retrieval evaluation.

F1 score compresses precision and recall into one classification or retrieval metric. Precision measures how many predicted positives are correct; recall measures how many actual positives are found. Because it uses their harmonic mean, improving both raises the score, while weakness in either remains visible. section 4.2.1 section 12.7.2

Toxic-comment moderation

A toxicity detector needs both precision and recall. Low precision sends too many harmless comments to moderators or hides legitimate posts; low recall lets more toxic comments through. F1 provides one benchmark for comparing models, but the underlying precision and recall still explain the operational trade-off. section 4.2.1

Use F1 to evaluate prediction systems at the level that matters:

  • Compare classifiers with one combined score when both missed positives and incorrect positive predictions matter. section 4.2.1
  • Evaluate intent-based chatbots with binary or generalized multiclass F1. section 12.7.2
  • For multi-label chatbots, average the individual intent F1 scores and inspect each intent separately to find weak points. section 12.7.2

F1 is not a complete evaluation picture. Inspect precision and recall alongside it, especially when deploying systems that alert moderators, hide content, or classify user intent. Retrieval-based chatbot evaluation uses different metrics, such as exact match, rather than automatically applying F1. section 4.2.1 section 12.7.2

How Natural Language Processing in Action, Second Edition covers it

How deep it goes
Defines the harmonic-mean relationship and applies it across binary, multiclass, and multi-label evaluation without deriving the formula.
Examples
Uses toxic-comment moderation, linear classifiers, topic representations, and chatbot intent labels as evaluation examples.
What it assumes
Assumes classification terminology, while defining precision and recall before applying F1 to chatbot variants.
What you can do after
Evaluate classification and intent systems, compare models, and diagnose weak intents by inspecting F1 with precision and recall.
How it connects
Connects precision, recall, binary classification, multiclass classification, multi-label classification, intent classification, and exact match.

Also explained in

Compare how 14 books explain f-score →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Natural Language Processing in Action, Second Edition. The section links point to the parts of the book it draws on.