Svashasan Logo
Simulated data

Automotive Performance Metrics · Detection metric

F1 Score

Also known as F1, F-score, F-measure, F-beta score

BeginnerSource-checked · awaiting technical reviewLast reviewed 6 December 2026

The F1 score is the harmonic mean of precision and recall: F1 = 2 × precision × recall / (precision + recall) = 2TP / (2TP + FP + FN). It is high only when both precision and recall are high.

Explanation

Because it is a harmonic mean, F1 is dominated by the lower of precision and recall: a detector with precision 0.99 and recall 0.10 scores only about 0.18. The general F-beta score weights recall β times as much as precision; F1 is the case β = 1.

F1 describes one operating point, a single confidence threshold and matching rule, whereas average precision summarises the whole precision-recall curve. It is often reported at the threshold that maximises it, which should then be stated. F1 does not use true negatives, which suits detection tasks where true negatives are not well defined.

Edge cases need a convention: with no TP, FP or FN the formula is undefined, and scikit-learn returns 0 by default unless configured otherwise. Values are only comparable with the same threshold policy, matching protocol and averaging across classes (macro, micro or weighted).

How it works

Compute TP, FP and FN at the chosen threshold and matching rule, then F1 = 2TP / (2TP + FP + FN). For several classes, either average per-class F1 (macro), pool counts across classes before computing (micro), or weight per-class values by class frequency, and state which was used.

Automotive applications

  • Selecting a deployment threshold
  • Lane detection benchmarks
  • Comparing classifiers on imbalanced data
  • Summarising detector performance per class

Example

A lane-marking detector has precision 0.93 and recall 0.81 at its current threshold: F1 = 2 × 0.93 × 0.81 / (0.93 + 0.81) ≈ 0.87. A lower threshold gives precision 0.88 and recall 0.88, so F1 = 0.88, and the team decides which error type matters more.

An illustrative example: any figures in it are worked numbers, not measurements.

References

  1. Metrics and scoring: quantifying the quality of predictions (opens in a new tab)

    scikit-learn developers · Project documentation · Precision, recall and F-measures · retrieved 6 December 2026

Definitions are original summaries. Standards text is not reproduced; follow the links for the official publications.