Learners choosing a machine-learning foundation · About 35 minutes

Catch data leakage before training a model

Split a tiny repeated-customer dataset and compute a baseline by hand before selecting a machine-learning course.

Use the sample below. No paid model, signup or course purchase is needed for this exercise.

Download the worksheet

Your starting material

Invented data: row,customer,month,renewed
1,A,Jan,yes
2,A,Feb,yes
3,B,Jan,no
4,B,Feb,no
5,C,Jan,yes
6,C,Feb,yes
7,D,Jan,no
8,D,Feb,yes
Goal: predict renewal for customers not seen during training.

Make your first attempt

  1. Try a row split: train on 1,3,5,7 and test on 2,4,6,8. Identify why that does not test performance on unseen customers.
  2. Use customers A and B for training; reserve C and D for testing. Keep the split fixed before comparing any methods.
  3. Compute an always-yes baseline on the held-out four rows. Write what this tiny example can and cannot establish.
Check your result

Try the task before opening these checks. Tick each one after comparing it with your own output.

Checks stay on this page only. Your answers and work are not uploaded.

Choose what to learn next

If the split and baseline are unfamiliar, choose a foundational course. If they are comfortable and you can code, a practical model-building route may be a better use of time.

Some course links may earn us a commission. Check current pricing and access terms before enrolling. Funding disclosure

Course sources

This worksheet is an original practice exercise. The following pages describe the learning options.

Try another exercise →