{
  "slug": "f1-score",
  "term": "F1 score",
  "aliases": [
    "balanced F-score",
    "F1 measure"
  ],
  "definition": "F1 score is the harmonic mean of precision and recall for a specified positive class and decision threshold.",
  "note": "For binary predictions, F1 = 2TP / (2TP + FP + FN). True negatives do not enter this formula. If TP, FP and FN are all zero, it is undefined, so the zero-division convention must be reported. F1 is neither recall nor accuracy, and multiclass or multilabel results must state the averaging rule. [sklearn-f1] Separately averaged or median precision and recall do not generally reconstruct an averaged or median F1. [sklearn-metrics]\n\nThe best threshold depends on the score scale. For calibrated probabilities, the F1-maximizing rule predicts positive when the probability is at least half the best achievable F1. A classifier that gives every case the same score is optimized by predicting all cases positive, which yields precision equal to the base rate b and F1 = 2b/(1 + b), about 0.18 at a 10% base rate. [f1-threshold]\n\nBecause true negatives are ignored, a high value can hide failure on the other class. In one constructed set with 91 positives and 9 negatives, TP = 90, FN = 1, FP = 9 and TN = 0 gave F1 = 0.95 and accuracy 0.90, while the Matthews correlation coefficient was -0.03. [mcc-advantages]",
  "limitations": [
    {
      "text": "A single F1 value does not state how many healthy drives trigger alerts or the operational cost of false alarms. Retain precision, recall, prevalence and the counting unit.",
      "citationIds": [
        "sklearn-metrics"
      ]
    }
  ],
  "related": [
    "precision",
    "recall",
    "false-positive-rate",
    "class-prevalence",
    "average-precision",
    "temporal-validation",
    "matthews-correlation-coefficient",
    "brier-score"
  ],
  "citations": [
    {
      "id": "sklearn-f1",
      "title": "scikit-learn: f1_score, binary formula, averaging and zero-division conventions.",
      "url": "https://scikit-learn.org/stable/modules/generated/sklearn.metrics.f1_score.html",
      "accessed": "2026-10-14"
    },
    {
      "id": "sklearn-metrics",
      "title": "scikit-learn: precision, recall and F-measures; aggregation and metric denominators.",
      "url": "https://scikit-learn.org/stable/modules/model_evaluation.html#precision-recall-and-f-measures",
      "accessed": "2026-10-14"
    },
    {
      "id": "f1-threshold",
      "title": "Lipton, Elkan and Naryanaswamy. Thresholding Classifiers to Maximize F1 Score. ECML PKDD 2014, arXiv 1402.1892, sections 3 and 4.",
      "url": "https://arxiv.org/abs/1402.1892",
      "accessed": "2026-10-23"
    },
    {
      "id": "mcc-advantages",
      "title": "Chicco and Jurman. The advantages of the Matthews correlation coefficient over F1 score and accuracy. BMC Genomics 21, 6 (2020), use case A1.",
      "url": "https://bmcgenomics.biomedcentral.com/articles/10.1186/s12864-019-6413-7",
      "accessed": "2026-10-23"
    }
  ],
  "status": "shipping",
  "advantages": [
    {
      "text": "Precision and recall enter as one number that stays low unless both are reasonably high, which suits tasks where the positive class is rare.",
      "citationIds": [
        "f1-threshold"
      ]
    }
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-10-23",
  "provenance": [
    "f1-threshold read 2026-10-23, sections 3 and 4, for the threshold relation and the uninformative-classifier result.",
    "mcc-advantages read 2026-10-23, use case A1, for the confusion matrix and the three scores.",
    "sklearn-f1 and sklearn-metrics carry the formula and averaging conventions."
  ]
}
