(Can you read the confusion matrix and pull the right numbers into the right formula?)
Recall Solution 1.1
WHAT we want: fraction of all predictions that were correct.
WHY accuracy: the question says "how many did it get right overall" — no mention of a class we care about more, so we treat every cell equally.
Correct cells are the two "true" ones: TP+TN=60+110=170.
Total = all four cells =60+110+10+20=200.
Acc=200170=0.85Answer: 0.85 (85%).
Recall Solution 1.2
Precision asks: of everything I called positive, how much was right? The "called positive" column is TP+FP=60+10=70.
P=7060=0.857Recall asks: of everything that actually was positive, how much did I catch? Actual positives are TP+FN=60+20=80.
R=8060=0.75Answers: P=0.857, R=0.75. Notice the denominators differ — that's the whole point of these being two different questions.
Recall Solution 1.3
The trick: the first word (True/False) tells you if the model was right; the second word (Positive/Negative) is what the model said.
(a) said positive, was right → TP
(b) said positive, was wrong → FP (Type I error, a false alarm)
(c) said negative, was wrong → FN (Type II error, a miss)
Acc=100030+940=1000970=0.97P=30+2030=5030=0.60R=30+1030=4030=0.75F1 — the harmonic mean, which drags toward the smaller of P and R:
F1=0.60+0.752⋅0.60⋅0.75=1.350.90=0.667Answers: Acc =0.97, P=0.60, R=0.75, F1=0.667.
Note how accuracy (0.97) looks glorious while F1 (0.667) is honest — because the negatives dominate.
Recall Solution 2.2
WHY this form exists: it skips computing P and R separately — you plug the raw counts straight in. It's algebraically identical (see the parent's derivation).
F1=2⋅30+20+102⋅30=60+3060=9060=0.667Match confirmed: 0.667. Same answer, fewer steps — handy when you already have the counts.
Recall Solution 2.3
P=1+01=1.0(every alarm it raised was correct)R=1+991=0.01(it caught 1 of 100 real positives)F1=1.0+0.012⋅1.0⋅0.01=1.010.02=0.0198Answers: P=1.0, R=0.01, F1≈0.0198.
This is the classic case: perfect precision, catastrophic recall. The arithmetic mean would give 0.505 (misleading); the harmonic mean gives ≈0.02 (honest) because it refuses to reward one metric when the other is near zero.
Model A:PA=18+3018=4818=0.375,RA=18+218=2018=0.90F1A=0.375+0.902⋅0.375⋅0.90=1.2750.675=0.529Model B:PB=14+314=1714=0.824,RB=14+614=2014=0.70F1B=0.824+0.702⋅0.824⋅0.70=1.5241.153=0.757By F1: Model B wins (0.757>0.529).
For cancer screening specifically: a missed cancer (FN) is catastrophic, so we prioritise recall. Model A catches 18/20 sick patients (recall 0.90); Model B misses 6 (recall 0.70). Model A is safer for screening despite its worse F1 — because F1 balances both errors equally, but here the two errors are not equally costly.
Lesson: the "better" model depends on which error hurts more, not on a single blended number.
Recall Solution 3.2
P=TP+FPTP,R=TP+FNTP
If FP=FN, the two denominators are identical and the numerators are both TP, so P=R. Call this common value x. Then
F1=x+x2x⋅x=2x2x2=x=P=R.Meaning: when your two error types are equal in count, all three of P, R, F1 collapse to one number — there's nothing for F1 to "balance". Model B in Example 4 of the parent (FP=FN=20) is exactly this case.
Key insight: F1 depends on P and R only — the raw counts have already been folded into those two numbers. So yes:
F1=P+R2PR=0.8+0.52⋅0.8⋅0.5=1.300.80=0.615Answer: F1≈0.615.
You cannot recover accuracy though — that needs TN, which P and R never see. This is why F1 survives on imbalanced data: it ignores the (often huge) TN count entirely.
Recall Solution 4.2
Step 1 — translate the requirement into recall. "At most 1 miss out of 20" means FN≤1, so TP≥19. At the boundary TP=19, FN=1:
R=19+119=2019=0.95.
So the recall floor is 0.95.
Step 2 — precision at FP=10:P=19+1019=2919=0.655.Step 3 — F1:F1=0.655+0.952⋅0.655⋅0.95=1.6051.245=0.776.Answers: recall floor =0.95, P≈0.655, F1≈0.776.
This is exactly how Threshold Optimization works: fix the metric a stakeholder cares about (here recall ≥0.95), then move the decision threshold to maximise the other.
(a) Accuracy:Acc=100000+9990=0.999=99.9%.(b) Recall:R=0+100=0.
Precision is 0+00=00 — undefined. By the standard scikit-learn convention we define precision =0 when there are no positive predictions (the model raised zero correct alarms). Then
F1=0+02⋅0⋅0→define as 0.
So recall =0, F1 =0.(c) A model can score 99.9% accuracy while being completely useless on the class that matters — proof that on imbalanced data accuracy is the wrong headline metric; recall/F1 expose the failure.
Recall Solution 5.2
(a) β=1:F1=(1+1)1⋅P+RPR=P+R2PR,
which is exactly the F1 formula. ✓
(b) With P=0.6, R=0.9:F2=(1+4)4⋅0.6+0.90.6⋅0.9=5⋅3.30.54=3.32.70=0.818.
Ordinary F1 for the same numbers:
F1=0.6+0.92⋅0.6⋅0.9=1.51.08=0.72.F2=0.818>F1=0.72.Why: here recall (0.9) is higher than precision (0.6). F2 leans toward recall, so it rewards this model more than the balanced F1 does. If instead precision had been the higher number, F2 would have scored lower than F1 — because it would be down-weighting the metric that happened to be strong. The moral: β lets you tune which mistake the score forgives.
Recall Self-check: what each metric refuses to look at
Accuracy uses all four cells including the huge TN — that's its weakness on imbalance ::: True; precision and recall both ignore TN, which is why F1 survives imbalanced data
The harmonic mean is used for F1 because it ::: collapses toward the smaller of P and R, punishing any model that is lopsided
To compute F1 you must have the raw counts TP, FP, FN ::: False — F1=P+R2PR needs only precision and recall