Robustness checks and the last look
Before the final test score, pressure-test the model against seeds, fold schemes, leaks and weak slices. Then take the one honest look, and decide what to do with it.
What runs in CodeSplash
- Linear / logistic regression Verified in Python and R
- Random forest Verified in Python and R
You will be able to
- Run seed, fold scheme, leakage, sensitivity and slice checks, and read each one
- Follow the full loop from baseline to registration
- Decide what to do when the test score disappoints
The whole loop
ReadBy now you know the order.
- Baseline, then a glass box, then a strong learner.
- Compare, paired, on the same folds.
- Tune the one that earned it.
- Threshold and calibration, for the decision.
- Explain: does it use what it should?
- Robustness and leakage: this lesson.
- Test once.
- Register.
Everything through step 6 uses folds. Only then do you open the lock.
Five questions
ReadRobustness asks five things of a run:
| Section | The question |
|---|---|
| Seed stability | Does the score or the importance order move with the seed? |
| Fold scheme | Does random folding beat grouped or time-ordered folds? |
| Leakage scan | Does one feature nearly determine the target? |
| Hyperparameter sensitivity | Is the setting on a knife edge? |
| Worst slices | Where is the model much worse than average? |
The top of the report gives a verdict: No problems found, Worth a closer look or Problems found.
Which is the alarm?
PredictPredict first
Three findings on a model that will score new customers. Which one should stop you from shipping today?
Reveal
Random folds beating grouped folds by a lot. It means the score you've been comparing on is inflated, because the model recognizes customers it has already seen. A small seed effect is normal. A weak slice is worth looking into, but it's exploratory: many slices were compared, so some look bad by chance.
Slices and many looks
ReadWorst slices scans category levels, quartiles of numeric features and missing values, on out-of-fold rows. It's a search, so its worst findings are partly luck. Treat it as a place to look, with 95 % interval in hand, and not as a result.
If a slice matters for its own sake, such as a group with legal protection, decide that beforehand and check it directly. Fairness does this for groups you name.
See how a good score can lie
ExplorePick each entry in The pipeline, and look at which symptom you'd need to see it. Which would Leakage scan catch? Which would Fold scheme catch? Which would neither catch?
DExplorable · Leakage detective
Why does a model that scores brilliantly in testing fail on real data?
Read the pipeline on the left. Will its cross-validation score overstate real-world accuracy by more than 6 points?
The pipeline
Commit your prediction above to see the result
Make your prediction to see the result.
Opening the lock
ReadSay Pima's forest looks right: cross-validated AUC 0.835 and test AUC 0.793. A logistic model: 0.857 and 0.810.
Test below cross-validation is normal, especially after a search. Report the test number, with how many runs touched the test set.
If it's far below, don't tune against it. Look for why, on the folds: leakage, a shifted test period, or too much selection. Any fix means the test set has been spent, so you'll need new rows for a fresh look.
Your checklist
ReflectThink of a model you've shipped or reviewed. Which of the five checks would have changed the decision? Which of steps 1 to 8 did you skip? If a colleague asked how many runs touched the test set, could you tell them?
Check your understanding
CheckpointCheck yourself
Across seeds, CV AUC varies far less than the fold-to-fold SD, and Kendall τ (importance) is high. What's the right reading?
Show the answer
Answer: a
That's what you hope to see. A low τ would tell you not to over-read the importance order.
Check yourself
You test a model trained with random folds on grouped folds, and Random folds better by is large and red. What's the next step?
Show the answer
Answer: a
If the model will meet new entities, grouped folds are what match. The random-fold score overstates performance.
Check yourself
Your test AUC comes out well below cross-validation. A colleague suggests retuning with a focus on those rows. Why not?
Show the answer
Answer: b
Investigate on folds. If you must change the model, get fresh rows for the next honest look.
Check yourself
When should you score the locked test set?
Show the answer
Answer: c
Every earlier look lets the test rows help choose, and so the number stops being an honest estimate.
Run it
In the appOpen your best run's Robustness tab. Set Seeds, Group folds by or Order folds by time, and Hyperparameters, then press Run checks. Read the verdict and each section. When it's clean, press Register on the run to send it to Models, as the walkthrough does with a model of {{target}}.
Recap
Recap- Pressure-test the model on folds: seeds, schemes, leaks, sensitivity and slices.
- The fold-scheme gap is the alarm to take most seriously. Worst slices are a place to look.
- Test once, report it as it is, and don't tune against it.
Concepts in this lesson