learn-data-centric-ai-with-phoebe / Session 4 of 6
Learn Data-Centric AI with Phoebe · Session 4 of 6

The data-edit bench

Sessions 1 to 3 built the pieces: a frozen model, a locked test set, a declared noise plant, and a detector that finds wrong labels without reading every row. Tonight they meet on one bench, computed in your browser. Eight data edits, each scored on the same 500 clean test digits by the same k-nearest-neighbour model, and each reported with two counters: the test accuracy, and how many of the 133 planted errors the detector actually found. One edit is the one every stalled project asks for, and it makes things worse. One is a leak that looks like rigour.

🔴 Bench night Bring your session 3 flags No code tonight, all clicking 45 min
0-3 · Welcome 3-14 · How to read the bench 14-40 · The eight edits, in order 40-45 · Q&A
Part 0

Where we start

A bench holds everything still except the thing being tested. Here the model is frozen, the 500 test digits are frozen, and the only thing that moves is the training data: which rows are in it, and what they are labelled. The data are real, all 1,797 images of the UCI handwritten digits. The noise is not: it is a plant, declared in full, which is the one thing that lets the bench count how many wrong labels a detector found. On your own data you never get that column, and the second half of tonight is about what to do instead.

🎫 Clear all three quiz questions to stamp your passport measured = computed from the rows and the frozen model planted = countable only because the noise is declared

★ What you walk out with tonight. The measured cost of each data edit on one frozen model, the habit of reading accuracy and detector recall side by side, the reason more data from the same labellers bought nothing, and the leak that makes a detector look precise while it finds a third of what it should.

Part 1 · covers what the bench measures

Two counters, one frozen model

6 min live

Every readout carries a tag. measured numbers come from running the frozen model on the edited training rows and scoring it on the test digits; they would be the same in any language, and a Python reference reproduces them to the last test image. planted numbers compare the training labels against the declared plant; they exist only because the bench knows which 133 labels it corrupted.

ONLY THE DATA MOVES. TWO COUNTERS READ WHAT IT DID 800 training rows 133 labels planted wrong relabel or remove flags drop ambiguous rows shift the weakest digit add 497 more rows the leak: in-sample kNN, k = 10 frozen 500 test digits clean, never edited MEASURED accuracy PLANTED precision recall compared with the declared plant The top dial exists on every project. The bottom dial exists only on a bench, because only a bench knows the answer key.
🔍 Click to zoom - the rust dial is the one you will not have at work, so tonight is the night to learn what it would have told you
LiveThe measured counter: accuracy on 500 clean digits3 min▶

Test accuracy is the share of the 500 test digits the frozen model gets right after the edit. One test digit is 0.2 points, so a difference of one or two digits on a single seed is not a finding. The readout also prints the difference against the baseline, and the ceiling: the same model trained on the true labels gets 489 of 500, 97.8 percent. That ceiling is knowable only because the plant is declared.

Training rows says how many rows the edit left. Removal shrinks the set; relabelling keeps it; augmentation and extra data grow it. Reading accuracy without this number hides what an edit cost.

Per-digit test accuracy sits under the readout, with the change against the baseline for each digit. It is there to be read, never to choose an edit: session 5 picks the weak digit on the training set.

LiveThe planted counter: precision, recall and what is left3 min▶

Detector precision is the share of flagged rows that really were planted errors. Recall is the share of the 133 planted errors the detector flagged. Wrong labels left counts training rows whose label still differs from the true digit after the edit, including any a relabel got wrong. Accuracy can saturate while these keep moving, which is why the bench reports both: a detector that finds a third of the errors can still lift accuracy, and you would never know it had missed two thirds.

Under the readout the bench prints where the flags go, the off-diagonal of the confident joint, and the per-class thresholds, then draws every flagged row from its own 64 pixels with a rust ring when it was a planted error and a grey ring when it was a false alarm. The last gallery is the planted errors the detector missed. Look at them: they are the 7s that look most like 1s.

Build-along · the bench

Eight edits, computed in front of you

★ 26 min · the main event

Work down the eight in order. For each, read the verdict, then accuracy against the baseline, then the two planted counters, then the thumbnails. Say out loud what changed before moving on. The two red cards are the traps. Each edit takes a moment to compute, because the model really runs: four-fold cross-validation for the detector, then a full scoring pass.

Read it in this order. Baseline first, and sit with 91.4 percent against the 97.8 percent ceiling: that gap of 32 test digits is what the planted labels cost. Then the anti-lever, then the two confident-learning edits, then the three variations. Below the eight cards, the knobs let you combine edits freely; every combination is computed the same way, and session 6 asks you to find the best one.

Part 2 · covers what the eight edits find

Same model, eight answers

6 min live

The bench computes these live; the numbers here are the ones it prints for the shipped seed, written down so they can be argued with after class. Because one seed is one draw, the same ladder was also run on twenty seeds with the same plant rule, and the last column gives the twenty-seed mean. Where the two disagree, the mean is the claim.

TEST ACCURACY, SAME FROZEN MODEL, 500 CLEAN DIGITS axis runs 90 to 98 percent, 72px per point · the dashed line is the baseline True labels (ceiling) Relabel, shift the weakest Remove what CL flags Relabel what CL flags Collect 497, clean all Relabel, drop ambiguous The leak Baseline 497 more, same noise 97.8 96.0 95.8 95.6 95.6 95.0 94.8 91.4 90.8 90 92 94 96 98 Every dot right of the dashed line is a data edit that beat the baseline on the same frozen model. One dot is left of it.
🔍 Click to zoom - the only edit that lost ground was the one that added data without looking at it
EditTrain rowsTest accuracyvs baselineWrong labels left20-seed mean
True labels (reference)80097.8%+6.4097.26%
Baseline, the labels you were given80091.4%013389.97%
Add 497 more, same noise1,29790.8%-0.621990.22%
Remove what CL flags70295.8%+4.44894.17%
Relabel what CL flags80095.6%+4.26194.45%
Relabel, then drop ambiguous69095.0%+3.62393.61%
Relabel, then shift the weakest digit1,08496.0%+4.66194.52%
The leak: relabel with an in-sample detector80094.8%+3.49592.70%
Collect 497 more, and clean all of it1,29795.6%+4.211894.60%

Shipped seed 20210921, the one of twenty whose ladder sits closest to the twenty-seed mean. All counts computed; the plant is constructed.

LiveFinding 1: cleaning the 800 is worth about four points2 min▶

Confident learning flags 98 of the 800 rows. 85 of them are planted errors, a precision of 86.7 percent, and it finds 85 of the 133, a recall of 63.9 percent. Removing the 98 takes the frozen model from 91.4 to 95.8 percent; relabelling them to the suggested digit takes it to 95.6. Every one of the 85 caught errors is relabelled to its true digit; the 13 false alarms are relabelled wrongly. Over twenty seeds removal averages +4.20 points and relabelling +4.48, and neither is ever worse than the baseline. On this seed removal edges ahead by one test digit; on the mean relabelling does. Call them about equal, and choose by what the removed rows would have cost to collect.

LiveFinding 2: the cleaner set scored lower2 min▶

Dropping ambiguous rows after relabelling, the 110 rows whose ten neighbours reach no majority, leaves only 23 wrong labels in training, the cleanest set on the ladder. It scores 95.0 percent, below plain relabelling at 95.6. The ambiguous rows are mostly correctly labelled digits that sit near a boundary, and near-boundary rows are exactly what a nearest-neighbour model needs to place the boundary. Fewer wrong labels is not the goal; a better model on the test set is. Try the same knob on the 1,297 rows in the knobs panel and it helps instead, which is session 5's small-data lesson.

Self-studyThe honest dip: shifting the weakest digit bought almost nothing on average2 min▶

On this seed, adding four one-pixel shifts of every training 9, the digit the relabelled training set agrees with least under cross-validation, takes the model to 96.0 percent, the best preset, and lifts test 9s from 56 to 59 of 65. Over twenty seeds the same edit averages +0.07 points over plain relabelling. That is the measurement: augmentation adds coverage of an invariance, and on 8 by 8 digits whose main problem is wrong labels, coverage is rarely the bottleneck. A one-pixel shift at this resolution is also a four-pixel shift of the original 32 by 32 scan, a coarse transform. Session 5 is about when augmentation is the right edit.

Part 3 · covers the anti-lever and the leak

More of the same, and a detector that grades itself

4 min live

Two edits on the bench look reasonable in a planning meeting and lose ground on the counters. Both fail for mechanical reasons you can draw.

WHY MORE ROWS DID NOT HELP WHY THE IN-SAMPLE DETECTOR MISSES ten nearest to a test 7 moss: a 7 labelled 7 rust: a 7 labelled 1 dashed: the pool's 7s labelled 1, same place, same mistake Base 91.4% with 497 more: 90.8% In sample each row is its own nearest neighbour and votes for its own label recall 30.1% Out of sample, 4 folds the row is held out, so only its neighbours vote on what it looks like recall 63.9% Systematic noise is reinforced by more rows; a wrong label that votes for itself is never flagged. Both are measured above.
🔍 Click to zoom - more data from the same labellers adds rust dots where the rust dots already are
LiveWhy 497 more rows made it worse2 min▶

The plant is systematic. The 7s labelled 1 are the 7s that look most like 1s, and the pool's 7s labelled 1 are the same kind of 7. Adding them puts more wrong votes in exactly the neighbourhoods where the model was already confused. The bench shows 457 correct becoming 454, and the wrong labels in training rising from 133 to 219. Over twenty seeds the change averages +0.25 points and is worse than the baseline in 8 of 20: "about nothing", with the sign decided by the draw.

The honest nuance: this is not a law that more data never helps. With purely random noise, more rows do average the errors out, and the homework in session 1 asks you to see it. And more data that is cleaned too, the last preset, reaches 95.6 percent. The trap is more data from the same process, unexamined.

LiveWhy the in-sample detector looks precise and is not2 min▶

Confident learning needs out-of-sample predicted probabilities; the paper fixes four folds of cross-validation, and the MIT notes say "We use cross-validation to obtain predicted probabilities out-of-sample." With in-sample votes each training row is its own nearest neighbour at distance zero, so every row casts one vote for its own label before anyone else votes. The detector flags only 42 rows, 95.2 percent of them real errors, and finds 30.1 percent of the planted errors against 63.9 out of sample. Precision went up while recall halved, and a team reading only precision would call it an improvement. Accuracy lands at 94.8 against 95.6.

This is detector leakage, the row seeing its own answer, and it is a different animal from feature leakage, where a column carries the target. Feature leakage belongs to Feature Engineering ↗.

Real world

"We need more labelled data" is the most common request in a stalled project. Ng's slide makes the counter-claim for small data: with 500 examples and 12 percent noise, cleaning and doubling the set are "about equally effective". The bench adds a sharper version: when the new rows come from the same labellers with the same guideline, doubling can be worth nothing at all. Ask where the new labels will come from before asking how many.

What to ask for, if you lead the team. For any cleaning pass, ask for two numbers, not one: how many rows were flagged, and on a hand-checked random sample of flags, what share were really wrong. Then ask how the probabilities were produced. If the answer is not "out of sample", the precision number is flattering a detector that is missing most of the errors.

Homework

Before session 5

30 min
  1. Fill the eight-row table from the bench in your own notes, adding a column for detector recall. Circle the row whose accuracy and recall disagree most.
  2. Find a combination that beats 96.0 percent with the knobs, and write down which edits it uses and how many training rows it ends with.
  3. Look at the missed gallery. Pick five missed rows and write, for each, whether you would have labelled it correctly yourself. That is the ceiling any label-quality process has on this data.
  4. Estimate your own planted counter. For your last cleaning pass, how would you measure precision without an answer key? Session 6 needs the answer.
Check yourself

Three questions

Clear all three and session 4 gets stamped in your passport.

1 · Relabelling with an in-sample detector flags 42 rows at 95.2 percent precision; the out-of-sample detector flags 98 at 86.7 percent. Which is the better detector?

Precision alone rewards a detector for flagging less. Recall is the second counter that exposes it, and the mechanism is the reason confident learning requires out-of-sample probabilities. Accuracy also falls, 94.8 against 95.6.

2 · Dropping ambiguous rows after relabelling leaves only 23 wrong labels, the cleanest set, yet scores 95.0 against 95.6. What is going on?

Wrong labels left is a planted counter, and it is not the objective. On the 1,297 rows the same knob helps, 96.6 percent with relabelling, because a bigger set can afford to lose its boundary rows. Session 5 turns that into a rule for small data.

3 · A manager asks for 497 more labelled rows from the same vendor. What does the bench say to expect, and why?

The honest claim is "about nothing, sign decided by the draw", not "always worse". C overstates it the other way. The useful follow-up question is how the new labels will be produced, which is session 2.

Sources covered

What this session teaches, and where it came from

✓Every accuracy, flag and count on the benchComputed in the browser from the 1,797 UCI digits (Alpaydin and Kaynak, 1998); reproduced to the row by an independent Python run, and swept over twenty seeds
✓Confident learning: thresholds, the confident joint, out-of-sample probabilitiesNorthcutt, Jiang and Chuang (2021), JAIR, read from the paper; four folds as in its experiments
✓Cleaning against doubling on small dataNg (2021) slide claim quoted as a claim; the bench measures one version of it
◐Precision and recall of the detectorCountable only because the noise plant is constructed and declared; real noise has an unknown shape
◐How far the ladder transfersNot claimed. One small image dataset and one frozen model; the mechanisms transfer, the point values do not

Every fact on this page, and its verification tier, is recorded in the course's source map.

Session 4 cheat sheet · pin this

Two counters, alwaysAccuracy on untouched test data, and detector recall. Precision alone flatters.
Cleaning the 80091.4 to 95.8 removed, 95.6 relabelled. About +4 points on twenty seeds.
More of the same90.8. Systematic confusions repeat; clean the new rows too.
Out of sample or nothingIn-sample recall 30.1 against 63.9. A row must not vote for itself.
Cleaner is not betterDropping ambiguous rows: 23 wrong labels left, 95.0 percent.
One seed is one drawOne test digit is 0.2 points. Quote the twenty-seed mean.