Learn from data without leaking the answer
Design an evaluation that measures useful generalization rather than accidental memorization.
What you’ll learn
- Separate fitting from model selection and final evaluation
- Identify leakage across related examples
- Choose a metric that reflects the cost of mistakes
Describe the prediction before collecting columns
Imagine predicting whether a learner will need help with a practice question. Define the moment when the prediction will be made, the information available at that moment, and the outcome it should predict. A column recording whether the learner eventually asked for a hint is not an input available before that request. Including it can make a model appear excellent while teaching it the answer. A feature is useful only if it is legitimately available at the intended decision time.
Give the data separate jobs
Use training examples to fit model parameters. Use validation examples to compare reasonable model or feature choices. Hold a test set aside for an evaluation after those choices. The purpose is to reduce the chance that repeated design decisions adapt to the final benchmark. There is no universally correct percentage split: dataset size, rare outcomes, related records, and the expected deployment setting matter. Write down the split procedure and random seed where randomness is used so another contributor can reproduce it.
Trace a hidden relationship
Suppose 100 learners each answer 20 questions. Randomly splitting the 2,000 answer rows can put one person’s nearly identical activity patterns in both training and test data. If the goal is to predict for completely new learners, split by learner instead. If the goal is to predict next month from earlier activity, a time-based evaluation may be more informative. The split should simulate the intended use, not merely produce equal-looking spreadsheet tabs. Check duplicates and related examples before believing a high score.
Compare against an honest baseline
Assume 90 of 100 examples do not need help. A classifier that always predicts no help achieves 90 percent accuracy while missing every learner who needs assistance. Count true positives, false positives, and false negatives, then examine precision and recall for the help-needed class. Discuss the cost of an unnecessary offer versus a missed intervention. A simple baseline exposes whether a more complex model adds practical value. Also inspect performance across relevant groups when the dataset supports a meaningful comparison.
Keep evaluation separate from a guarantee
An offline score estimates behavior on the chosen evaluation data; it does not promise future performance. Changes in question difficulty, population, interface, or data collection can alter results. Document dataset provenance, consent and privacy constraints, known gaps, and the evaluation date. Keep the first project small: implement a baseline, check leakage, calculate a confusion matrix by hand on a tiny sample, and only then add a learned model. Clear evidence is a stronger foundation than a sophisticated model with an unexplained score.
Try it yourself
A dataset has 500 rows from 50 learners and a feature called final_score. You need to predict difficulty before a course begins for new learners. Identify two leakage risks and propose a useful baseline.
Show a possible solution
Keep each learner in one split so the evaluation represents new learners, and remove final_score because it is unavailable before the course. Compare against a simple rule or majority-class baseline, reporting a metric that captures missed learners rather than accuracy alone.
Check your understanding
Try 11 questions across machine learning. Read each explanation and revisit anything that needs another pass.
Practise this subjectGo to the source
Use these primary references to check details and explore the topic further.
Saved in this browser. Signed-in progress syncs to your account.