Skip to content
Tactiverge

Learning Rooms/□ Level 4 · Systems Engineer/Computing and algorithms

Machine Learning Fundamentals: Cross Validation

StatQuest with Josh Starmer · 6 min 4 s · captions on YouTube · nothing loads until you press play

By the end you can…

  • Explain k-fold cross-validation.
?Predict▶Watch✓Practise⚙Build

Watch it all: no segment has been checked by hand for this video yet.

1.Predict before you press play

With 5-fold cross-validation, how many times is each example used for testing?

Pick one before you press play. A wrong guess is fine: it is what makes the video stick.

2.See the idea first

Play with this diagram for a minute. It gives you something to hang the video on.

Loading the interactive…

Can't use the diagram? Read a description instead

The k-fold diagram shows 24 labelled readings as a row of boxes numbered by fold (example i belongs to fold i mod k); the held-out fold is filled in. For each fold a threshold classifier is trained on the other folds (threshold halfway between the two class means) and tested on the held-out fold. A list gives each fold's training size, test size and accuracy, and the readout reports the mean accuracy, its standard deviation and its range for k = 2, 3, 4 or 6.

3.Watch, actively

Cross-validation: how to test a model on data it hasn't seen.

6 min 4 s · captions on YouTube · source

Nothing loads from YouTube until you press play.

Watch for…

  • → Watch for every block of data taking a turn as the test set, and how the results are combined.

Pause whenever you like. Rewatching a hard minute is a good habit, not a failure.

Can't stream it? Read the idea instead

A model scored on the data it learned from looks better than it really is. Cross-validation splits the data into parts, trains on all but one and tests on the one left out, then rotates. Every point is used for testing exactly once, giving a fairer score.

What the video covers (our own note, written when we verified it): Cross-validation: how to test a model on data it hasn't seen.

Written by Tactiverge in our own words, not a transcript. The full lesson below explains the idea without the video.

Read it instead

Jot down one thing that surprised you and one question you still have.

Private: saved only on this device, never sent to Tactiverge.

4.Practise what you just saw

These come from the lesson that use this video and are checked on the server. Wrong answers get a hint and another try.

Practice 1

You run 10-fold cross-validation on 500 examples. How many examples are in each held-out test fold?

Practice 2

Which of these causes data leakage in cross-validation?

Practice 3

Fold accuracies are 90, 72, 88, 91 and 74%. What should you report?

Practice 4 · a fresh version every time

A classifier is evaluated with 10-fold cross-validation. The accuracies on the 10 held-out folds are 81.7%, 71.2%, 86.5%, 84.4%, 81.8%, 81.9%, 74.2%, 72.9%, 74.9%, 81.5%. What is the mean cross-validated accuracy, in percent? (2 decimal places)

%

5.Try it yourself

No simulation models this idea yet. The lesson below has an interactive diagram instead.

6.Where engineers use it

For a vibration classifier recorded on 6 machines, split by machine (6 grouped folds): each fold asks “does it work on a machine it has never heard?”, which is the question the field deployment will ask. Splitting by individual recordings would mix each machine into both sides and report a falsely high score.

From the applied view in the lesson Cross-validation: grading a model fairly. Checked by automated tests only.

7.Build something with it

Follow-up project

You have 240 labelled audio clips from 8 rooms (30 per room) for a keyword spotter. Design the evaluation: how you would form folds (and why by room), how many clips each model trains and tests on, what you keep back as a final test, and the one table you would publish.

Split 10 data points into 5 folds and list which are tested in each round.

Where this video lives

In the course catalogue: AIP-520 Embedded machine learning

The video is by StatQuest with Josh Starmer, embedded from YouTube with privacy-enhanced mode and never autoplayed. The room around it (prompts, notes, practice, projects) is Tactiverge's, written with AI assistance and checked by automated tests only.