Skip to content
RED SAGSkills
easyMachine Learning Engineer interview question

What are the training, validation and test sets used for, and how do you split them?

What the interviewer wants to hear

  • Training set fits parameters
  • Validation set tunes hyperparameters and picks models
  • Test set gives a final unbiased estimate, used once
  • Split respecting time, groups and class balance (stratify)

Model answer

The training set is what the model learns its parameters from. The validation set is used to compare models and tune hyperparameters such as learning rate or tree depth. The test set is held back until the very end and used once to estimate how the final model will perform on new data. If I keep checking the test set while tuning, it stops being unbiased. How I split depends on the data. For classification with imbalanced classes I use a stratified split so each set has similar class ratios. For time-based data I split by time, training on the past and testing on the future. If the same user or patient appears many times, I split by group so the same person is not in both train and test, which would leak information.

Can you answer it under time pressure?

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

Start mock interview

More easy Machine Learning Engineer questions