Last year's students
Lesson 0012 · Homework 1, Problem 1
Thresholds and policy
Sage trains on last year's students. The model outputs a score. Next year's students get predicted before the support problem happens, so the university can act in time.
Visual walkthrough
Watch the validation mistake happen.
The last two scenes show why random row splitting is the wrong target: weekly rows from the same student can leak across train and holdout. The fix is to hold out whole students, and ideally a future entering class.
Problem 1(a)
One pipeline. Three different jobs.
The fitted model produces s_i. The threshold rule produces a_i. Moving t changes the action rule, not the trained model.
Do not mix these up
Last year's students have answers. Next year's students do not yet.
Next year's students
How the dataset is built
Last year's students become training data when the year is over.
Sage records only what can be observed while the year is still happening. The same student can appear in several weekly rows. Once the year ends, the outcome label is attached to each of those rows, and the fitted model can score next year's students before the problem happens.
Same student, several weekly rows
After the year ends
Incoming student, scored by the model
Problem 1(d)
Same PID means same student.
Validate on students the model has never seen.
Answer: split by student ID, or hold out next year's entering class. Random rows can put one student's earlier weeks in training and later weeks in test.
A tempting but wrong analogy
"32 is enough" is a statistics answer, not an ML answer.
Sage remembers a stats course: once you have a sample size of about 32, the sampling distribution of the mean is close enough to normal, and a bigger sample mostly buys you a tighter confidence interval on a fixed, low-dimensional quantity — a mean, a proportion, a slope. Sage reasons that 100 student records should be more than plenty.
f^D is a different kind of problem — you're searching over a whole family of functions for one that captures how features relate to the outcome, and you don't know in advance how much data that search needs. A model too flexible for the data available will fit noise in those 100 records instead of the real pattern, and no formula tells you the right amount up front the way the CLT tells you 32 is enough for a mean.
This is exactly why the holdout set exists: not to compute a textbook confidence interval, but to give an honest, out-of-sample check on whether f^D has actually learned something transferable or has quietly memorized last year's roster. If the holdout error is much worse than the training error, that's the empirical signal that more data (or a simpler model) is needed — a diagnosis a sample-size formula can't give you, because there was never a fixed target quantity to solve for.
Now pick a number
100 student records. 80/20? 90/10? Something else?
After grouping by student, choose the train/holdout balance.
noisy estimate
weaker model
rotate whole students
Takeaway: no magic ratio. Use enough holdout students to trust the estimate and enough training students to resemble deployment.
Where does the threshold fit in?
The threshold t doesn't decide the split — but a bad split corrupts your choice of t.
Grouping by student and choosing a split ratio happen before scoring; the threshold is chosen afterward, by looking at TPR/FPR tradeoffs on the holdout scores (as in the panel above). The two questions are separate — but not independent. If a random-row split let copies of the same student leak into both train and holdout, the holdout scores s_i would look more separable than they really are, so whatever threshold you pick by staring at those scores would look better in validation than it performs on genuinely new students next year. A leaky holdout doesn't just inflate accuracy — it inflates confidence in a specific, deployed decision rule δ_t. Get the holdout design right first; only then is the threshold tuning on it trustworthy.
Problems 1(b) and 1(c)
Move the cutoff. Watch the mistakes move.
The dots are the held-out sample from the homework. Drag the threshold, then compare the two worked checkpoints. This is the part where prediction becomes action before the student needs support.
t = 0.50
TPR = 2/4 = 0.50
FPR = 2/4 = 0.50
t = 0.30
TPR = 3/4 = 0.75
FPR = 3/4 = 0.75
The policy tradeoff
Lower threshold: more help, more false alarms.
Capacity changes deployment
Only four calls this week.
The scores stay fixed. The office adds a practical rule: sort by score, then contact the top four it can actually handle.
What stays fixed?
A, D, f^D, scores s_i
Changesthreshold t, decision rule δ_t, actions a_i
Validationhold out whole students, not random weekly rows