What F1 Does and Does Not Say
Break an exact F1 = 0.60 tie between [3, 1, 3, 23] and [6, 8, 0, 16] with F_beta while noting TN blindness.
The problem
Suppose we tighten Grid B's cutoff until its false alarms drop from 18 to 8, producing Grid C ([TP, FP, FN, TN] = [6, 8, 0, 16]) on our same 6-positive, 24-negative benchmark. Grid A ([3, 1, 3, 23]) has F1 = 6 / 10 = 0.60, and Grid C has F1 = 12 / (12 + 8 + 0) = 12 / 20 = 0.60 — another exact tie. Does F1 = 0.60 mean the two classifiers are interchangeable?
We generalize F1 to F_beta = (1 + beta^2) * TP / ((1 + beta^2) * TP + beta^2 * FN + FP) across beta from 0.5 to 2.0 to see what F1 says and what it leaves unsaid.
Work through the numbers
Compare Row 0 ([3, 1, 3, 23], P = 0.75, R = 0.50) and Row 1 ([6, 8, 0, 16], P = 3/7 ≈ 0.429, R = 1.00):
- `beta = 1.0` (`beta^2 = 1.0`, equal weight): Row 0 scores
6 / (6 + 3 + 1) = 0.600; Row 1 scores12 / (12 + 0 + 8) = 0.600. - `beta = 0.5` (`beta^2 = 0.25`, precision prioritized): Row 0 rises to
3.75 / (3.75 + 0.75 + 1) = 15 / 22 ≈ 0.682, beating Row 1's7.50 / (7.50 + 0 + 8) = 15 / 31 ≈ 0.484. - `beta = 2.0` (`beta^2 = 4.0`, recall prioritized): Row 0 falls to
15 / (15 + 12 + 1) = 15 / 28 ≈ 0.536, losing to Row 1's30 / (30 + 0 + 8) = 15 / 19 ≈ 0.789.
Changing beta flips the winner by +0.198 in one direction (beta = 0.5) and -0.254 in the other (beta = 2.0) without changing a single prediction.
The live model
Two horizontal bars display F_beta for cautious Grid A ([3, 1, 3, 23], amber) and recall-first Grid C ([6, 8, 0, 16], green), above a card showing active beta^2 weight on FN and the untouched TN cells (23 vs 16). Drag beta from 0.5 to 2.0: the bars cross at beta = 1.0 (0.60 tie), favoring Grid A below 1.0 and Grid C above 1.0.
![Two equal F_beta bars at 0.6 for Grid A [3, 1, 3, 23] and Grid C [6, 8, 0, 16] when beta is 1.0.](../assets/ml/what-f1-does-and-does-not-say--demo.png)
let beta = scene.parameter("beta", 1.0, 0.5, 2.0, 0.5);
let tp = input.slice(1, 0, 1);
let fp = input.slice(1, 1, 2);
let miss_pos = input.slice(1, 2, 3);
let b2 = beta * beta;
let num = tp * (1.0 + b2);
let den = num + miss_pos * b2 + fp;
let answer = num.div(den);
out.set("f_beta", answer);
{
"f_beta": [
[
0.6
],
[
0.6
]
]
}Your turn
Compute the [2, 1] column answer of F_beta scores for both rows using b2 = beta * beta. The starter writes tp instead of num (tp * (1.0 + b2)) inside the denominator. Check tests unseen two-row confusion matrices at beta = 2.0 and beta = 0.5.

let beta = scene.parameter("beta", 1.0, 0.5, 2.0, 0.5);
let tp = input.slice(1, 0, 1);
let fp = input.slice(1, 1, 2);
let miss_pos = input.slice(1, 2, 3);
let b2 = beta * beta;
let num = tp * (1.0 + b2);
let den = tp + miss_pos * b2 + fp;
let answer = num.div(den);
out.set("f_beta", answer);
{
"f_beta": [
[
0.8571428571428571
],
[
0.8571428571428571
]
]
}Compute the [2, 1] column answer of F_beta scores using num = tp * (1.0 + b2) and den = num + miss_pos * b2 + fp.
Read the result carefully
F1 says one clear thing: whether a classifier achieves high precision and high recall simultaneously without letting either rate collapse. Three critical facts remain outside binary F1's reach:
- Asymmetric error costs:
F1weightsFPandFN1:1in2*TP + FP + FN. When recall isbetatimes as important as precision (missing a positive costsbeta^2 = 4times a false alarm),F2encodes that preference explicitly; when false actions are expensive,F0.5(beta^2 = 0.25) protects precision. - True-negative blindness: neither
F1norF_betaever readsTN(23vs16). Appending10,000routine negatives (TN) leaves everyF_betabar unchanged, so pairF_betawith specificity or false-positive rate when negative volume matters. - Zero true positives: when
TP = 0, the rate formula2 * P * R / (P + R)evaluates to0 / 0, whereas the count formula2 * TP / (2 * TP + FP + FN)gives0as soon asFP + FN > 0; standard evaluation reports adopt the count convention (F1 = 0whenTP = 0andFP + FN > 0) and state how they treatTP = FP = FN = 0.
With more than two classes, there is no single F1 score: reports distinguish per-class F1 (scoring each class one-versus-rest), macro F1 (the plain unweighted mean of the per-class scores), micro F1 (computed from TP, FP, and FN pooled across all classes), and weighted F1 (averaging per-class scores weighted by each class's true size), which diverge sharply under class imbalance.
Recap
- Grid A (
[3, 1, 3, 23]) and Grid C ([6, 8, 0, 16]) share6positives and24negatives and tie atF1 = 0.60. F_betaweightsFNbybeta^2relative toFP:beta = 0.5picks Grid A (0.682vs0.484), whereasbeta = 2.0picks Grid C (0.789vs0.536).- Neither
F1norF_betainspectsTN, and plainF1assumes equal cost per false positive and false negative.