Grid B Precision and Recall
Compute aggressive Grid B's precision 6/24 = 0.25, recall 6/6 = 1.00, flag rate 0.80, and arithmetic tie at 0.625.
The problem
Grid B ([TP, FP, FN, TN] = [6, 18, 0, 6]) achieves spotless recall by flagging 24 of the 30 rows (80% of the entire dataset), sweeping up all 6 genuine positives alongside 18 false alarms. What are Grid B's precision, recall, and overall flag rate, and why does the arithmetic mean (P + R) / 2 declare Grid B a dead-heat tie with cautious Grid A?
We compute [precision, recall, flag_rate] on Grid B as fp_cut converts 0, 6, 12, or 18 false alarms back into true negatives (FP_adj = FP - fp_cut, TN_adj = TN + fp_cut).
Work through the numbers
Evaluate Grid B ([6, 18, 0, 6]) at fp_cut = 0 (FP_adj = 18, TN_adj = 6, total rows 6 + 18 + 0 + 6 = 30):
1. Precision: TP / (TP + FP_adj) = 6 / (6 + 18) = 6 / 24 = 0.25. Three out of every four alerts are false alarms. 2. Recall: TP / (TP + FN) = 6 / (6 + 0) = 6 / 6 = 1.00. Zero positives are missed. 3. Flag rate: (TP + FP_adj) / 30 = 24 / 30 = 0.80. Four fifths of all rows land in the review queue.
Now check the arithmetic mean: (0.25 + 1.00) / 2 = 1.25 / 2 = 0.625 — matching Grid A's (0.75 + 0.50) / 2 = 0.625 to the third decimal place. Trimming fp_cut to 6, 12, and 18 lowers flag_rate to 0.60, 0.40, and 0.20 while lifting precision to 1/3, 0.50, and 1.00.
The live model
Three horizontal bars display Grid B's amber precision, green recall, and red flag_rate on [0, 1], above a summary card reporting (P + R) / 2 and active FP_adj. Slide fp_cut from 0 to 18 in steps of 6: at fp_cut = 0, red flag_rate spans 0.80 while (P + R) / 2 reads 0.625; at fp_cut = 18, all 18 false alarms move into TN_adj = 24 and flag_rate matches true prevalence 0.20.

let fp_cut = scene.parameter("fp_cut", 0.0, 0.0, 18.0, 6.0);
let tp = input.slice(0, 0, 1);
let fp = input.slice(0, 1, 2);
let miss_pos = input.slice(0, 2, 3);
let tn = input.slice(0, 3, 4);
let fp_adj = fp - fp_cut;
let tn_adj = tn + fp_cut;
let total = tp + fp_adj + miss_pos + tn_adj;
let precision = tp.div(tp + fp_adj);
let recall = tp.div(tp + miss_pos);
let flag_rate = (tp + fp_adj).div(total);
let parts = torch.list().add(precision).add(recall).add(flag_rate);
let answer = torch.cat(parts, 0);
out.set("grid_pr_flagrate", answer);
{
"grid_pr_flagrate": [
0.25,
1,
0.8
]
}Your turn
Compute [precision, recall, flag_rate] in answer after shifting fp_cut rows from fp into tn. The starter divides tp (6) by total (0.20) instead of dividing all flagged rows tp + fp_adj (24) by total (0.80). Check tests unseen four-cell vectors and positive fp_cut transfers.

let fp_cut = scene.parameter("fp_cut", 0.0, 0.0, 18.0, 6.0);
let tp = input.slice(0, 0, 1);
let fp = input.slice(0, 1, 2);
let miss_pos = input.slice(0, 2, 3);
let tn = input.slice(0, 3, 4);
let fp_adj = fp - fp_cut;
let tn_adj = tn + fp_cut;
let total = tp + fp_adj + miss_pos + tn_adj;
let precision = tp.div(tp + fp_adj);
let recall = tp.div(tp + miss_pos);
let flag_rate = tp.div(total);
let parts = torch.list().add(precision).add(recall).add(flag_rate);
let answer = torch.cat(parts, 0);
out.set("grid_pr_flagrate", answer);
{
"grid_pr_flagrate": [
0.25,
1,
0.2
]
}Compute the [3] vector answer = [precision, recall, flag_rate] with fp_adj = fp - fp_cut and tn_adj = tn + fp_cut.
Read the result carefully
Grid B exposes why (P + R) / 2 is dangerous in production: a trivial "flag nearly everything" rule guarantees R = 1.00, which single-handedly floors (P + R) / 2 above 0.50 no matter how close precision sinks toward zero. Even on a 20%-positive dataset (6 / 30), flagging all 30 rows would earn P = 0.20, R = 1.00, and (P + R) / 2 = 0.60 without learning a single feature. Any credible combined score must penalize lopsided (0.25, 1.00) pairs relative to balanced (0.75, 0.50) pairs.
Recap
- At
fp_cut = 0, Grid B ([6, 18, 0, 6]) hasprecision = 0.25,recall = 1.00, andflag_rate = 24 / 30 = 0.80. - Its arithmetic mean
(0.25 + 1.00) / 2 = 0.625ties Grid A's(0.75 + 0.50) / 2 = 0.625despite18false alarms versus1. - Reclassifying
fp_cutfalse positives intoTN_adj = TN + fp_cutpreserves total row count30while loweringflag_rate.