ML3: Classic models with scikit-learn

Lesson 5 of 5 · reading 15–25 minutes; practice and project time is on the module page

Tuning and choosing a model fairly

🎯You'll be able to

Tune a model's settings on validation data, choose between candidates, and know when a difference is too small to matter.

🏠The everyday picture

Choosing a cricket team, selectors pick from players' recent form, not from one lucky innings. They also pick the steady player over the flashy one if the scores are close. Choosing a model works the same way.

📘What it really is

📝A worked example

Input: a small grid for the kit's gradient boosting, scored on May (reference measurements, 2 November 2026):

Learning rate 7 leaves 15 leaves 31 leaves
0.03 0.5786 0.5631 0.547
0.05 0.5664 0.5617 (kit) 0.5317
0.1 0.5585 0.5524 0.5363

The best cell is 0.5786 (rate 0.03, 7 leaves), 0.017 above the kit's setting. A bootstrap estimate (ML4 Lesson 5) of May's score runs from about 0.485 to 0.638, so this difference is well inside the noise. You could choose either; the honest report gives the grid, the rule you used and the test result of the one you chose, once.

🌍Where it's used

📝Case scenario

A team reported that their new model beat the old one by 2 points. The new model had been tuned with 200 tries; the old one with its defaults. Given the same tuning budget, the old model was within half a point. They changed their review checklist to require equal budgets.

🖱️Try it

Run the grid above with random_state=0, then write a three-line decision: which setting you choose, the rule you used, and why the difference is or isn't meaningful. Success: your decision quotes May, not June.

⚠️Common mistakes

🛠️For your project

Project 1 records the validation scores used to choose (validation_pr_auc in metrics.json) and the choice made.

✅Quick check

What's the difference between a parameter and a hyperparameter?

Show the answer

Parameters are learned in training; hyperparameters are settings you choose before training.

When two models are within the noise, which should you choose?

Show the answer

The simpler, faster or easier-to-explain one, and say why.

← PreviousOverfitting, regularisation and cross-validation
ProLearners Assist