31. What are the distinct purposes of training, validation, and test data?
For a supervised model, define how each split is used during fitting, hyperparameter selection, threshold selection, and final performance estimation. Explain what information may cross each boundary, when a test set becomes contaminated, and how the split must respect the observation unit and intended deployment population.
Training data teaches the model parameters. Validation data guides choices such as hyperparameters and the decision threshold. After those choices are locked, the test set is evaluated once for the final performance estimate. The splits must avoid leakage, respect the observation unit, and represent the intended deployment population.
Training, validation, and test data have different jobs. The training set is used to learn model parameters such as weights or coefficients. The validation set is used to compare model choices, tune hyperparameters, and select a decision threshold. After those choices are fixed, the test set is used for the final performance estimate. Test information must not influence fitting or selection. A valid split must also prevent overlapping or closely related observations from leaking across boundaries and should represent the population and time period where the model will actually be used.
- What is the observation unit that must stay together when we split the data?
- Does deployment involve future data, so the split should preserve time order?
- What validation metric should guide model or hyperparameter selection?
- Do we need to choose a decision threshold after fitting the model?
- What population and time period should the final test set represent?
Start with the training set. Its purpose is learning. The fitting algorithm uses training examples to estimate model parameters, such as weights or coefficients, and capture patterns in the data. Any preprocessing step that learns values from data, such as scaling, encoding, imputation, or feature selection, must also be fitted using only allowed training data. The learned transformation can then be applied to validation and test data without refitting it there.
Next use the validation set for development choices. A model fitted on training data can generate predictions on validation data. Those results can guide hyperparameter selection, model complexity, regularization, feature or model choices, and decision-threshold selection. For example, candidate models may be compared with an appropriate validation metric. The diagram gives examples such as AUC or RMSE. For a thresholded classifier, the validation set can also be used to choose an operating point with a metric such as F1, precision at a required level, or another cost-sensitive criterion when that criterion matches the problem.
Validation information is therefore allowed to flow back into the development process as feedback. If validation results cause me to change hyperparameters, regularization, features, the model, or the threshold, that is expected. Because those choices were influenced by validation data, validation performance is not an untouched final estimate.
The test set has a different purpose. After training and validation-based choices are complete, I lock the preprocessing, features, model settings, and threshold. I then evaluate that fixed pipeline on the test set. If the test set has remained untouched and represents deployment, its result is the final estimate of how the chosen model should perform on new data from that setting. I should not use the test result for additional tuning and still describe a later score on the same test set as an untouched estimate.
A test set becomes contaminated when test information influences development. Examples include tuning hyperparameters using test performance, selecting the threshold after seeing test scores, repeatedly checking test results and choosing the best model, using test information for feature selection, or fitting preprocessing such as scaling, encoding, or imputation on all data before evaluation. Duplicates or near-duplicates across splits can also leak information and make performance look better than it really is.
The split must respect the observation unit. If several records belong to the same entity or time block and are not independent for the intended prediction problem, those records should stay in one split instead of being divided across training, validation, and test data. Otherwise the model may be evaluated on observations that are too closely related to data it already saw.
The split must also match the intended deployment population. The validation and test data should represent the population and time period where the model will be used. If the real task is future-facing, preserving time order may be more appropriate than a random split. Evaluating on a very different population or time period can produce a number that does not answer the real deployment question.
The diagram shows example proportions of roughly 60–80% training and 10–20% each for validation and test. These percentages are examples, not universal rules. The important sequence is: fit on training, tune and select on validation, lock the choices, and then evaluate once on the untouched test set.
- Define the observation unit and the intended deployment population and time period.
- Create non-overlapping training, validation, and test splits so related observations do not improperly cross boundaries.
- Fit learned preprocessing and model parameters using training data only.
- Apply the fitted pipeline to validation data and use validation feedback to choose hyperparameters, model complexity, features when appropriate, regularization, and the decision threshold.
- Repeat training and validation as needed without using test results.
- Lock the preprocessing, features, hyperparameters, fitted model procedure, and threshold.
- Evaluate the finalized model on the untouched test set for the final performance estimate.
- If test results influence another development decision, treat that test set as contaminated for final evaluation and use a new independent test set for a clean final estimate.
Keeping separate validation and test sets means fewer observations are available for model fitting. With a small dataset, that can make estimates noisier, so a careful validation method such as cross-validation may help during development while an independent final test set is still protected. Repeated tuning can also overfit to validation data. Group-aware or time-aware splitting may leave less convenient sample sizes than a random split, but it is necessary when it better matches the observation unit or deployment setting. The main tradeoff is using less data for fitting in exchange for a more trustworthy evaluation.
Interviewers want to know whether you understand why training, validation, and test data must have separate roles. They are testing whether you can fit a model, tune it without leaking information, keep the final test set independent, select thresholds correctly, and construct splits that respect observation units, time, and the intended deployment population. These choices determine whether the reported final performance is a trustworthy estimate for new data.
Common mistakes include fitting the model with validation or test data, tuning hyperparameters from test performance, choosing a threshold after seeing test results, repeatedly checking the test set and reporting the best run, fitting preprocessing on the full dataset before evaluation, allowing duplicate or closely related records from the same observation unit to cross splits, ignoring time order for a future-facing deployment, and evaluating on a population that does not represent intended deployment. Another mistake is treating example split percentages such as 60–80% training and 10–20% validation and test as mandatory rules.
Start with the simple rule: training learns, validation guides choices, and test estimates final performance. Then explain the boundary: validation feedback may influence development, but test information must not. Finish by mentioning observation-unit integrity, deployment population, time boundaries, and preprocessing leakage because these are common ways an apparently clean split becomes invalid.










