Specialty Digest

Global English editionLearners’ Study Dashboard — in development
The Knowledge Library for All

Flashcards: open the module flashcards (end-of-module review with workplace questions).

Online Courses / University Track / Learning from Data

Module 5 · Lab

Lab: split, choose and test a model honestly

Choose a model by validation error, report its test error once, compute the gain over a baseline and run a four-fold cross-validation.

  • 50 minutes
  • 14 marks
  • Self-marked

50 minutes. Self-marked against the rubric. 14 marks. In the full course this counts toward the labs and cases share (15% of the course grade). Write your answers in the boxes, then open the model answer and tick each mark you earned honestly. Nothing is sent or stored.

Scenario (invented)

A team (invented) predicts delivery times in minutes with three models of increasing flexibility. The table gives mean absolute error. The baseline (always predict the training mean) has a validation error of 16 minutes.

ModelTraining errorValidation error
A (simplest)1213
B67
C (most flexible)111

Later the chosen model is run once on the test cases and has an error of 8 minutes, while the baseline has 16 minutes on the same test cases. Separately, a four-fold cross-validation on 12 cases of a classifier gave 2, 3, 3 and 2 right out of 3 in the four folds.

Tasks

Task 1 (4 marks)

Choose a model and say what is wrong with each of the others.

Private: nothing you type here is sent or stored.

Task 2 (3 marks)

Find the improvement of the chosen model over the baseline on the test cases.

Private: nothing you type here is sent or stored.

Task 3 (4 marks)

Compute the fold accuracies and the cross-validated accuracy, and comment on the spread.

Private: nothing you type here is sent or stored.

Task 4 (3 marks)

A colleague tried k = 1, 3 and 5 on the test set, chose the best, and reports 90% test accuracy. What is wrong and how should it be fixed?

Private: nothing you type here is sent or stored.

Rubric and model answer

Task 1: choose (4 marks)

Model: choose B, the lowest validation error (7). A underfits: both errors are high. C overfits: training error 1 but validation error 11.

Task 2: improvement (3 marks)

Model: (16 − 8) ÷ 16 = 8 ÷ 16 = 50%.

Task 3: cross-validation (4 marks)

Model: fold accuracies 66.7%, 100%, 100% and 66.7%; total 10 of 12 = 83.3%. The folds range from 66.7% to 100%, so with three cases per fold the score is noisy.

Task 4: spot the leak (3 marks)

Model: the test set was used to choose k, so the 90% is optimistic. Choose k on a validation set (or by cross-validation) and use the test set once for the final score.

Marks so far: 0 of 14

Review with flashcards

Test yourself on this module with workplace flashcards and detailed answers.

Open the module flashcards