Why a Model Can Fit the Data and Still Predict Badly | Overfitting, Leakage and the Unseen Test

A model’s ability to fit known data is not the same as its ability to predict new data. A sufficiently flexible method can learn noise, accidental details or information that would not be available at prediction time. The repair is to preserve genuinely unseen cases and evaluate the model on the job it will actually perform.

This applies to statistical models, machine learning, trend lines and even informal rules students invent from examples. The more a method is adjusted to the observed cases, the more important independent testing becomes.

The perfect training score that collapses tomorrow

Imagine a fictional prediction system built from twenty historical cases. After repeated adjustments, it classifies all twenty correctly. The team announces 100 percent accuracy.

That statement is accurate about the cases used to construct and tune the system. It does not establish 100 percent accuracy on future cases.

If the model has learned quirks unique to those twenty observations, new data can expose the gap immediately.

Training performance answers an easier question

Training data have influenced the model. Good performance there asks whether the method can fit information it has already used.

Prediction asks something harder: can the learned relationship transfer to observations that did not participate in fitting or tuning?

Keep these results separately labelled. “Training accuracy” should not silently become “accuracy”.

More flexible models can fit more noise

Draw two points and many curves can pass through them. Add more points and a sufficiently complicated curve can still be constructed to hit every one. Exact interpolation does not prove that the wiggles correspond to a stable process.

Overfitting occurs when the model captures idiosyncrasies of the observed sample that do not generalise well. The problem is not complexity by itself; complex relationships can be real. The issue is complexity unsupported by transferable signal.

Compare performance on data not used to choose that complexity.

Repeatedly checking the test set can turn it into training information

Suppose the team evaluates on a held-out set, changes the model after seeing the result, evaluates again, changes it again, and repeats this twenty times.

The holdout has now influenced model selection. Even if its rows were never directly used in the fitting algorithm, information from its performance has leaked into development decisions.

Use validation data for model choice and preserve a final test set for a less-contaminated evaluation, or use an appropriate resampling design. The exact workflow depends on data size and modelling context.

Leakage can make prediction look impossibly good

Data leakage occurs when model inputs contain information that would not legitimately be available at the time the prediction is meant to be made.

For example, predicting whether an assignment will be late using a field recorded only after submission would create a misleadingly powerful model. The feature contains information from the future relative to the intended prediction point.

Split data according to the real decision process, not merely by random rows when time or grouped identities make that inappropriate.

Repeated observations can leak identities across the split

If the same student contributes many nearly identical records, placing some in training and some in testing can make the test easier than predicting for a genuinely new student.

Whether this is a problem depends on the intended job. If the system will predict future observations for known students, within-student information may be legitimate. If it must generalise to unseen students, the evaluation should reflect that target.

The unit of splitting must match the unit of generalisation.

Distribution shift can defeat a well-tested model

A model can perform well on a proper historical test and still degrade when the environment changes. New curricula, user behaviour, sensors, definitions or populations can alter the relationship learned from earlier data.

This does not prove the original evaluation was dishonest. It means generalisation was conditional on the data-generating process remaining sufficiently similar.

Monitor relevant changes after deployment and re-evaluate when the operating context moves outside the conditions represented by the original evidence.

A high score can optimise the wrong metric

Accuracy can be misleading when one class dominates. If 99 percent of cases are negative, predicting negative every time gives 99 percent accuracy while identifying none of the rare positives.

Choose evaluation measures according to the decision and error costs. Precision, recall, calibration, mean absolute error and other measures have different jobs.

The companion Goodhart’s-law article explains why a convenient metric should not replace the underlying objective.

Simple baselines prevent impressive uselessness

Compare the model with a simple alternative: previous value, group mean, majority class or another domain-appropriate baseline.

A complicated system that scores 91 percent may sound impressive until a trivial baseline scores 92 percent. The relevant question is improvement over an appropriate alternative, not sophistication of the machinery.

Baselines also help detect data leakage: implausibly large gains deserve investigation before celebration.

The repair routine

Define the future prediction job first. Decide which information will genuinely be available then. Split or resample data in a way that respects time, groups and the intended unit of generalisation.

Use training data to fit, validation information to choose among alternatives, and preserve independent evaluation where feasible. Compare with simple baselines and report uncertainty rather than only the best score.

After deployment, monitor whether the population or measurement process changes. A model validated yesterday is evidence about yesterday’s conditions, not a permanent guarantee.

For the deeper modelling route, continue through Residuals, Outliers and Anomalous Data and the Mathematics Article Directory.

A model earns trust not by remembering the past beautifully, but by surviving a fair encounter with information it did not get to rehearse.

Explore the connected learning guides

Choose the question that brought you here. Open one useful guide, try a small task, and stop when you have what you need.

Take one question further

The same learning habit can travel across subjects, while each subject keeps its own methods. These routes help you notice a difficulty, understand one part of it, and return to something you can do.

A word is familiar, but using it is difficult.

Move from recognising a word to retrieving it in a new context. Understand vocabulary plateaus.

Try it without the guide: Choose one word you already know. Close the guide and use it in a new sentence. Explain why it fits; try another context tomorrow.

A piece of writing has ideas, but the reader loses the thread.

Make the order of events and the links between sentences clear. Explore composition writing.

Try it without the guide: Choose one short paragraph. Read the relevant explanation, close it, and revise the paragraph. Ask someone to tell you what happened and why.

The Mathematics seems familiar, but marks still disappear.

Find the first point where the working stops being reliable. Find Secondary 4 A-Math mark leakage.

Try it without the guide: For a Secondary 4 A-Math question you have attempted, locate the first uncertain line. Repair that step, then try a comparable question without the worked answer.

A Science fact is remembered, but the explanation is incomplete.

Connect the evidence to a scientific idea and the resulting change. Follow the Primary Science learning route.

Try it without the guide: Choose a familiar Primary Science example. Explain the evidence, the idea and the result without notes. Then change one condition and explain your prediction.

Two accounts of the world seem to disagree.

Check the question, source, date and evidence before combining claims. Explore the World Knowledge research library.

Try it without the guide: Take one claim. Find the source best placed to support it, note its date, and state what remains uncertain. Return to your original question.

There is plenty of help, but independence is hard to see.

Check what the learner can understand and do after support is removed. Understand how education works.

Try it without the guide: Choose one small task the child has practised. Agree on a calm, brief attempt without prompts. Use what happens to choose one next step, then stop.

For the structure behind these connections, read the eduKateSingapore runtime manifest and the eduKate ecosystem boot contract. The reader map describes public navigation; those manifests preserve the wider ownership and return rules.

Discover more from eduKate Singapore

Subscribe now to keep reading and get access to the full archive.

Continue reading