Back to Classical Machine Learning
Classical Machine Learning · Lesson 1 of 3 in this module
Explain: Training versus checking
Why did that happen?
A very bendy curve can follow random bumps in the practice dots. That does not mean it will work well on new dots. Keep the final test separate from choosing settings. Looking at it, changing your choice, and testing again is more practice—not a fresh final test.
Explain it in your own words · optional
Compare your prediction and explanation with the observed numbers.
Try a different case · guided practice
Two candidates have training/validation losses A: 0.01/0.40 and B: 0.08/0.12. Before opening the test, which choice is best supported by these losses alone?
Need a hint?
Ask which results you used to make your choice. Those results helped with practice, even if their original name was “test”.
How this helps your classifier project
Use the classifier’s candidate comparison and frozen test deliberately. A saved candidate is a reproducible configuration, not proof of future performance.
Watch how it works Perfect training can predict badly
Understand what changed.
A shorter explanation, with the original worked examples available below. Both explain the same experiment and its limits.
The idea in everyday terms
A model can fit familiar examples very closely and still predict new ones poorly. Training examples are used to adjust its parameters. Validation examples help choose settings, such as how flexible the curve should be. A final test checks the chosen model after those decisions are fixed.
What to watch in the experiment
Compare both error curves as you change complexity. A more flexible curve may follow noise in the training points. Lower training error alone cannot tell you whether that extra detail helps elsewhere. Freeze your choice before revealing the test result.
What this does not establish
This is a small synthetic experiment. Looking at the test and then tuning again makes it familiar development evidence; resetting the model cannot make that evidence unseen.
Open the full worked examples, calculations and limitations
This is the same reference used in Technical mode. Expand it whenever you need the exact numbers, assumptions or further explanation.
Three datasets, three jobs
Training data fits the parameters. Validation data helps you choose settings such as model size or regularization. Test data estimates the final chosen model’s performance after those choices are frozen. Reusing the test score to make choices turns it into another validation score.
The lab uses 12 training points, 24 validation points, and 24 separately generated test points. All come from the same smooth toy relationship with independent noise. Circles are training observations; diamonds are validation observations. The curve is fitted only to the circles. The final test observations remain hidden until you freeze your choice.
A split must match the real task. If two almost identical photos of the same object land in different sets, the test may be too easy. For predicting the future, a time-based split can be more appropriate than shuffling everything. No split repairs unrepresentative or incorrectly labeled data by itself.
The most flexible curve is not always the best predictor
A polynomial adds powers of the input. Degree 1 is a straight line; a higher degree can bend more. In this lab, degree 11 has enough flexibility to pass through all 12 training points. Some of those points contain random noise, so a perfect fit can make the curve worse between them. This is overfitting. A model too restricted to capture the useful pattern underfits.
Compare degrees 1, 4, and 11. Training error falls as flexibility increases, but validation error does not keep falling. The comparison table reports actual measured errors from the fits; it is not an invented performance curve. Here, fitting solves a small least-squares system directly rather than running the gradient-descent animation from the previous module.
Every learning process has preferences
An inductive bias is a preference among explanations that could fit the observations. Model architecture, initialization, optimizer, regularization, and data all shape that preference. A model looking at neighboring pixels favors different patterns from one comparing words across a sentence.
Regularization adds a cost for certain parameter choices. Our lab penalizes the squared nonconstant polynomial coefficients. The fit therefore trades training error against that penalty. The displayed losses remain ordinary mean squared errors, without adding the penalty. This particular penalty depends on the numerical basis used to express the polynomial; it is one teaching choice, not a universal measure of simplicity.
More parameters do not automatically imply worse generalization. Modern networks can generalize even when they have enough parameters to memorize their data. Parameter count alone does not describe the solution actually found.
A good test has a boundary
Even an independent test only samples the conditions it contains. A model trained on bright photographs may fail in dim light. This is distribution shift: the conditions change. Test meaningful variations and report failures alongside successes.
Our frozen test is a small estimate, not proof of real-world reliability. If you reopen tuning after seeing it, it is no longer an unseen test. The lab keeps that warning even after a reset. In a real project, reserve new independent evidence for the next final claim.
Notes, help and related ideas
My notes and reflection
What will you take away?
Keep a private reminder for yourself.
Loading your journal…
Add a short reflection
Prerequisites and related ideas
Key terms: Generalization Overfitting Inductive bias Validation data