02 · See it in action
Follow the steps
- Build a confusion matrix with true and false positives.
- Calculate precision using predicted positives as the denominator.
- Calculate recall using actual positives as the denominator.
- Compare thresholds on validation examples before selecting one.
Worked example
True positives = 8, false positives = 2, false negatives = 4
Precision = 8 / (8 + 2) = 0.80
Recall = 8 / (8 + 4) = 0.667
F1 = 2 * precision * recall / (precision + recall) ≈ 0.727
Read the example once, then explain each part aloud in your own words. If it includes Python, you can understand the idea first and run the code later in a local Python environment. Code is shown as text; this page does not execute it.
Sign in to save your reading progress.
Sign in