Skip to content
RED SAGSkills
easyData Scientist interview question

Why do we split data into training, validation and test sets? How do you decide how to split?

What the interviewer wants to hear

  • Training data fits the model parameters
  • Validation data is used for tuning and model choice
  • Test data gives a final unbiased estimate and is used once
  • Split by time for forecasting and by entity to avoid leakage
  • Cross-validation helps when data is small

Model answer

The training set is what the model learns from. The validation set is used to compare models and tune hyperparameters, and because we make many choices with it, its score becomes slightly optimistic. The test set is kept aside and used once at the end to estimate how the model will perform on truly new data. How I split depends on how the model will be used. If it predicts the future, I split by time, training on older data and testing on newer data. If one customer has many rows, I split by customer so the same person never appears in both training and test, otherwise the model can memorise them. For small datasets I use k-fold cross-validation for tuning to get more stable estimates, but still keep a final holdout when possible.

Can you answer it under time pressure?

Take a timed easy round and get scored on every answer.

Start mock interview

More easy Data Scientist questions