1. University MCA (AI/ML) Semester 2
  2. CAB212
  3. Unit 1

CAB212 · Unit 1: Machine learning foundations

Train/validation/test splits and cross-validation

8 practice questions

Key points

  • Test set is used once at the end
  • k-fold: k fits, each sample validated once
  • Stratify to preserve class ratios
  • Fit scalers on training data only

Split data into three parts:

  • Training set: fit parameters.
  • Validation set: choose hyperparameters and compare models.
  • Test set: final unbiased estimate, used once.

A common split is 70/15/15 or 80/10/10. For classification use stratified splits so class proportions are preserved.

k-fold cross-validation: split data into k equal folds; train on k-1 and validate on the remaining fold, rotating k times; average the k scores. Typical k is 5 or 10. Leave-one-out is k = n.

Each sample is used for validation exactly once and for training k-1 times. Cost is k model fits.

Data leakage: any information from validation/test data influencing training (for example fitting a scaler on the full dataset before splitting). It inflates scores.

Exam pitfall: the test set must not be used for tuning; otherwise it becomes a second validation set.

Try two questions

Question 1 · Tier 1, Recall

The set used for the final unbiased performance estimate is the:

  1. Bootstrap set
  2. Validation set
  3. Test set
  4. Training set
Show the answer

C. Test data is held out until the end.

Question 2 · Tier 1, Recall

In k-fold cross-validation, how many times is the model trained?

  1. k-1 times
  2. Once
  3. k times
  4. n squared times
Show the answer

C. One fit per fold.