AI Glossary / AI foundations / Beginner

F1 score

Definition

The F1 score is a single number between 0 and 1 that summarizes how well a classification model performs by combining precision and recall using their harmonic mean. It is not the same as accuracy, and it says nothing about true negatives. A score of 1 means no false alarms and no misses. Some teams report it as a percentage, and variants such as the F-beta score weight recall or precision more heavily.

What it means

Many business models sort items into two groups: fraud or not fraud, urgent ticket or routine ticket, likely churn or likely to stay. Two questions matter. When the model raises a flag, how often is it right? That is precision. Of all the real cases out there, how many did the model catch? That is recall.

The two pull against each other. A model that flags almost everything catches nearly every real case but buries your team in false alarms. A model that flags almost nothing is rarely wrong but misses most real cases. The F1 score squeezes both questions into one figure, so you can compare models without juggling two numbers. A model only scores high on F1 if it does reasonably well on both.

How it works

Start with a confusion matrix, which counts four outcomes: true positives (flagged and real), false positives (flagged but not real), false negatives (real but not flagged) and true negatives (not flagged and not real). Precision is true positives divided by all flagged items. Recall is true positives divided by all real items.

F1 is the harmonic mean of the two: 2 times precision times recall, divided by precision plus recall. The harmonic mean is used instead of a simple average because it punishes imbalance. If precision is 1.0 and recall is 0.1, the simple average is 0.55, which sounds decent, but F1 is about 0.18, which tells the truth about a model that misses most cases.

Because F1 ignores true negatives, it suits problems where the positive class is rare and matters most. When there are more than two classes, teams average F1 across classes. Macro averaging treats each class equally, while micro averaging pools all the counts. These can give different answers, so always check which one a report uses. F1 also depends on the decision threshold, the cutoff that turns a model's score into a yes or no, so changing the threshold changes the F1.

Three practical examples

  • Finance team: A bank's model flags card transactions as possible fraud. Analysts care that real fraud is caught but also that customers are not blocked without cause. F1 on a labeled test set gives one number for comparing a new model against the current one.
  • Retailer: A model tags product reviews that mention a safety problem. Safety reviews are rare, so accuracy would look high even if the model tagged none. F1 focuses on how well the rare safety class is found and how clean the tags are.
  • Support desk: A classifier marks incoming tickets as urgent. Missing an urgent ticket is costly, and flagging everything defeats the purpose. The team tracks F1 for the urgent class as a balanced check on both problems.

Think of it this way

Think of a fisherman with a net. Precision is how much of the catch is the fish you wanted rather than junk. Recall is how many of the wanted fish in the lake ended up in the net. F1 is a single grade for the whole outing. The analogy stops working because a fisherman rarely weighs a missed fish and a piece of junk equally, while F1 treats precision and recall as equally important unless you change it.

Worked example

A model reviews 1,000 invoices, and 50 of them are truly duplicates. The model flags 40 invoices. Of those, 30 are real duplicates (true positives) and 10 are not (false positives). It misses 20 real duplicates (false negatives).

Precision = 30 / 40 = 0.75. Recall = 30 / 50 = 0.60.

F1 = 2 x 0.75 x 0.60 / (0.75 + 0.60) = 0.90 / 1.35, which is about 0.67.

Now compare accuracy. Correct calls are the 30 true positives plus the 940 true negatives (1,000 minus 30, 10 and 20 gives 940), so 970 of 1,000 are right and accuracy is 97 percent. That looks excellent, yet the model missed 40 percent of the duplicates. F1 of 0.67 gives a more honest picture.

Illustrative case study

Fictional case: Larkfield Logistics, a mid-sized freight broker, built a model to flag shipments likely to be delayed. The first version reported 94 percent accuracy, and the operations lead was pleased. But dispatchers said they were still surprised by late deliveries. The data team checked and found that only 6 percent of shipments were ever delayed, so a model that predicted no delays at all would score 94 percent accuracy.

The team switched to precision, recall and F1 for the delayed class. The first model had recall of 0.20, so F1 was low at about 0.31. They retrained with more weight on delayed examples and lowered the threshold for raising a flag. Recall rose to 0.65, precision fell to 0.55, and F1 reached about 0.60. Dispatchers now got useful warnings, and they agreed on a rule for reviewing the threshold each quarter.

Common misconceptions and mistakes

A high F1 means the model is good for my business. F1 treats false alarms and misses as equally costly, which is rarely true. Check the real costs of each error type and consider whether precision or recall matters more.

F1 is just another name for accuracy. Accuracy counts all correct answers, including true negatives, while F1 uses only precision and recall for the positive class. On rare-event problems the two can differ widely.

One F1 score describes the model completely. F1 changes with the decision threshold and the test data. Report it alongside precision, recall and the size and mix of the test set.

A good F1 on test data guarantees good results in production. Real data drifts over time and may differ from the test set. Keep measuring on fresh, labeled samples after launch.

Business use

To start, build a labeled test set that reflects real conditions, including the true share of rare cases. Compute precision, recall and F1 for the class you care about, then compare candidate models and thresholds. Agree in advance with the business owner what each type of error costs, since that decides whether plain F1 or a weighted version such as F2, which favors recall, is the right target.

Measure F1 on a regular schedule after launch, and track precision and recall separately so you can see which one moves. The costs are mostly labeling effort and the discipline of keeping test data current. The risks are optimizing the number rather than the outcome, and hiding poor performance for small groups inside an average. Where decisions affect people, check scores for relevant subgroups as well.

People also ask

What is a good F1 score?

It depends on the task and the cost of errors. A score near 1 is strong, but a 0.6 may be useful if it replaces a slower manual process. Compare against a simple baseline and the current human result.

Why not just use accuracy?

Accuracy can look high when one class is rare, because always guessing the common class is usually right. F1 focuses on how well the rare class is found and how reliable the flags are.

When should I use F2 instead of F1?

Use F2 when missing a real case costs more than a false alarm, such as screening for safety issues. F2 weights recall more heavily than precision.

Check your understanding

In the worked example, what are the precision and recall?

Answer: Precision is 30 / 40 = 0.75 and recall is 30 / 50 = 0.60.

Why does the invoice model have 97 percent accuracy but an F1 of only about 0.67?

Answer: Most invoices are not duplicates, so many true negatives lift accuracy. F1 ignores them and reflects the 20 missed duplicates and 10 false flags.

Why is the harmonic mean used instead of a simple average?

Answer: It punishes a large gap between precision and recall, so a model cannot hide a very low value behind a very high one.

What does F1 leave out?

Answer: It leaves out true negatives and does not account for the different real-world costs of false alarms and misses.

Related terms

  • Precision
  • Recall
  • Accuracy
  • Confusion matrix
  • Classification
  • Threshold
  • ROC curve
  • Class imbalance

Learn next

Pick one classification task in your own work and write down the cost of a false alarm and the cost of a miss. Then read the entries on precision and recall, and on the confusion matrix, to see how the four outcomes are counted. After that, look at class imbalance and the ROC curve to understand how thresholds and rare events change the picture.

More in AI foundations

  • Embodied AI - Embodied AI is artificial intelligence that has a physical body, such as a robot, a vehicle or a machine with sensors and moving parts, and learns or acts...
  • Encoder-decoder model - An encoder-decoder model is a neural network design with two connected parts. The encoder reads an input and turns it into an internal representation.
  • Expert system - An expert system is a computer program designed to apply specialized knowledge to problems within a defined domain.
  • Feature - A feature is one measurable input field a model learns from, such as a customer's age, an order's total or the hour a call arrived.
  • Feature attribution - Feature attribution is a family of explainability methods that assign each input feature a score showing how much it pushed a model's output up or down for...
  • Fine-tuning - Fine-tuning is additional training that adapts a pretrained model to a particular task, domain, or desired behavior.

Sources

Google, Machine Learning Glossary: https://developers.google.com/machine-learning/glossary Russell and Norvig, Artificial Intelligence: A Modern Approach: https://aima.cs.berkeley.edu/ Goodfellow, Bengio and Courville, Deep Learning: https://www.deeplearningbook.org/ The sources were consulted for the standard definitions of precision, recall and the F1 score; the examples, analogy, worked example and case are original educational illustrations. Checked 5 Nov 2026.

Previous: F-test of equality of variances Next: Fabric computing

  • Home
  • Daily AI Updates
  • Blog
  • AIFBL Academy
  • AI Glossary
  • Products and Tools
  • Store
  • Free CFO AI Prompt Pack
  • About Shihan Sheriff
  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Cookie Policy
  • Earnings Disclaimer