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 8 · Lesson 3 · Core

Choose on validation, then test once

Break the tie on the validation cases, run the chosen rule on the test cases a single time and compare it with the baseline.

  • 50 minutes
  • Serves O8
  • Assumes M8.L2

Phase 1: Prepare

Step 1 Warm-up recall

From M8.L2: which two rules tied on training accuracy?

Private: nothing you type here is sent or stored.

Step 2 Learning goal

By the end of this lesson you can:

  • choose between rules using validation accuracy (Foundation);
  • run the chosen rule on the test cases once (Core);
  • compare the test result with the baseline (Core).

Phase 2: Teach

Step 3 A familiar example

A recipe is tried at home several times and adjusted. The final dinner for guests is cooked once, from the recipe as it stands, and judged as it comes out.

Step 4 Clear explanation

The two tied rules are now scored on the six validation cases (2 N, 3 N, 4 Y, 5 Y, 7 Y, 9 Y). The rule at 4 predicts renew for 4, 5, 7 and 9, which are all correct, and leave for 2 and 3, also correct: 6 of 6. The rule at 6 predicts renew for 7 and 9 only, so it misses members 4 and 5, who renewed: 4 of 6, or 66.7%. The baseline of always renew scores 4 of 6 on these cases, also 66.7%.

Rule ≥ 4100%Rule ≥ 666.7%Baseline: always yes66.7%Invented example: validation accuracy
The validation cases break the tie: the rule at 4 gets all six right, the rule at 6 gets four.

We choose renew if visits are at least 4. Now, and only now, run it on the six test cases (1 N, 3 N, 4 N, 5 Y, 6 Y, 8 Y). It predicts renew for 4, 5, 6 and 8 and leave for 1 and 3. The member with 4 visits left, so that is one error: 5 of 6, 83.3%. The baseline gets 3 of 6, 50%.

Chosen rule ≥ 483.3%Baseline: always yes50%Invented example: test accuracy
On the test cases, used once, the chosen rule beats the baseline by 33 points, though six cases are few.

The rule beats the baseline by 33 points, a worthwhile gain, but notice the sample: with six test cases, one case is worth 16.7 points. The 100% on validation was also a small-sample result, and it was higher than the test score because we chose the rule using those cases. The test result is the one to report, with its size.

The test cases are then closed. If the rule is changed after seeing the test, the test is no longer a fresh test.

Step 5 Worked example (4 marks)

A rule scores 4 of 6 on validation and a competitor scores 5 of 6. On the test cases the competitor gets 4 of 6, and the baseline gets 3 of 6. Which is chosen, and what is reported?

  1. Validation accuracy: 4 ÷ 6 = 66.7% and 5 ÷ 6 = 83.3%; the competitor wins. (1 mark)
  2. The test is used once for the competitor: 4 of 6 right. (1 mark)
  3. Test accuracy = 4 ÷ 6 = 66.7%; baseline 3 ÷ 6 = 50%. (1 mark)
  4. Answer: choose the competitor and report 66.7% on the test against the 50% baseline. (1 mark)

Go deeper: the professor's notes

Choose on validation and test exactly once.
Validate

Choose.

Test once

Confirm.

Noise

One case 16.7 points.

Validaterule at 4: 100%Chooserule at 4Test once83.3%Reportvs 50% baseline
Test

Results

ItemAccuracy
Rule at 4 validation100%
Rule at 6 validation66.7%
Rule at 4 test83.3%
Baseline test50%

At work: Choose and test

Six validation, six test cases.

  1. Score the tied rules on validation.
  2. Run the chosen rule on the test once.

What a careful practitioner decides. Report 83.3 percent against 50, with n = 6.

Phase 3: Practise

Step 6 Learner practice (instant-marked)

1. The validation cases are used to:

2. The test cases are used:

3. 5 of 6 correct on the test is an accuracy of:

4. With 6 test cases, one case is worth about:

Phase 4: Close

Step 7 Recap

  • Validation chooses; the test confirms once.
  • Compare the test score with the baseline.
  • With few cases one case moves the score a lot.

Step 8 Exit ticket (ungraded)

A rule gets 9 of 12 on the test. What is its accuracy and what is one case worth?

Private: nothing you type here is sent or stored.

Step 9 Go further (Extension)

Explain in two sentences why the validation score of the chosen rule is higher than its test score here.

In industry: Civil war prediction: complex models, simple baseline

In a reproducibility study of civil war prediction, a field where complex machine learning models were believed to vastly outperform older statistical methods, Kapoor and Narayanan found that the papers claiming a clear advantage failed to reproduce because of data leakage. When the errors were corrected, complex models did not perform substantively better than decades-old logistic regression.

Link to this lesson. Always compare against a simple baseline, and distrust a large gap.

Source: Kapoor and Narayanan (2023), Patterns 4(9):100804; preprint arXiv:2207.07048

Common mistakes

MistakeWhy it fails
Changing the rule after seeing the testClose the test.
Reporting validation as finalReport the test.
Ignoring the baselineCompare to it.

Limits. Six test cases give a very rough figure; the lab shows a case where the model matches the baseline.

Flashcards for this lesson (3)

Tap a card to reveal the answer. Read the question, answer it aloud or in writing first, then check yourself against the explanation.

Card 1 of 3 · Why is training accuracy optimistic?
Chosento fitNew caseslowerExpecta gap
Optimism

The rule was chosen because it fits those cases. New cases will usually give a slightly lower score.

Card 2 of 3 · What do you do when two rules tie?
Rule 4100%Rule 666.7%Chooserule 4
Tie

Score both on the validation cases and choose the better. In the library example the rule at 4 scores 100 percent and the rule at 6 scores 66.7.

Card 3 of 3 · Why use the test cases only once?
TestonceChangespoils itReportthat number
Once

If the rule is changed after seeing the test, the test has influenced the model and no longer gives a fresh estimate.

Review with flashcards

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

Open the module flashcards