Skip to content
intermediate3 min readFree guide

Machine learning foundations: training, validation and honest evaluation

InterviewSolutionHub learning library · Updated

On this page

A model learns patterns from examples, but success on those examples does not prove it will work on new ones. Start with a clear prediction task and keep training feedback separate from final evaluation.

Define inputs, targets and a measurable error

For a simple prediction task, inputs are the information available before a prediction and targets are the desired outputs in labelled examples. A loss function describes a mismatch. Choose a measurement that fits the task: squared error and classification accuracy answer different questions, so one should not be presented as the other.

Separate fitting from evaluation

Training changes model parameters using training data. Validation can inform choices such as model settings, while a held-out test set is reserved for a later independent evaluation. Reusing evaluation results to repeatedly redesign the model gradually makes that evaluation less independent. Keep the roles clear even in a tiny classroom example.

Look for overfitting and leakage

A model may memorise patterns specific to its training set. Leakage occurs when information unavailable at prediction time enters the training or evaluation process. Examples include using a future outcome as an input or placing near-duplicate records across splits. A small successful demonstration is a learning exercise, not evidence of safe performance in a real deployment.

Worked example

A fictional model predicts study time from a short list of input features. Before training, separate examples and record which inputs would genuinely be known when a prediction is needed. If a feature is the final exam result, it cannot be used to predict that same result in advance.

Check your understanding

Try each question before opening its explanation. These are free practice prompts; they do not use game chances.

What is the difference between a parameter and a target?

A parameter is a value the model uses, such as a weight. A target is the desired output attached to a labelled example. Training adjusts parameters; it should not rewrite targets to make the score look better.

Can excellent training accuracy be misleading?

Yes. A model may overfit, use leaked information or encounter very different data after deployment. Training accuracy alone does not measure generalisation or suitability for a real task.

Why keep validation targets out of gradient updates?

Using them for updates turns those examples into training data. Their separate role is to provide feedback about performance on examples that were not used to fit those parameters.

Sources and further reading

These original examples explain foundational concepts. Use the official references for complete, current details and version-specific behaviour.

About this guide: AI-assisted educational content with original examples and linked primary references. Found an issue? Tell us what to improve.

Keep exploring Programming & technology

All subtopics →