← all tracks

Machine Learning

The core ideas, made visible — with scikit-learn.

35 of 35 lessons built·0 of 107 exercises solved
Module 1

Foundations

4/4

What learning from data means, the estimator API, and the one rule you never break.

  1. 1

    What learning from data means

    Features, target, generalisation — and when to write a rule instead

  2. 2

    The estimator API

    Four methods, two kinds of number, and one very informative underscore

  3. 3

    Train and test

    Hold rows back, look at them once — and know how much luck is in the number

  4. 4

    Your first model

    Eight lines, 79.6% accurate — and why that number should worry you

Module 2

Evaluating honestly

5/5

Why accuracy lies, what to measure instead, and how to get a number you can trust.

  1. 5

    Why accuracy lies

    A coin flip finds more late deliveries than our model does

  2. 6

    The confusion matrix

    Four numbers, and every classification metric is arithmetic on them

  3. 7

    Thresholds, ROC and PR

    predict() hides a choice you should be making yourself

  4. 8

    Cross-validation

    Take several measurements, report the spread, and keep the test set sealed

  5. 9

    Overfitting and underfitting

    Two failures that look identical from a bad score, with opposite cures

Module 3

Preparing data

4/4

Scaling, categories, missing values — and the pipeline that stops them leaking.

  1. 10

    Scaling

    Which models care about units, which do not, and why "always scale" is cargo cult

  2. 11

    Categorical features

    Three unused text columns are worth more than any model change so far

  3. 12

    Missing values

    Why the gap is there matters more than what you fill it with

  4. 13

    Pipelines and leakage

    A 0.9989 AUC is a bug report, and a Pipeline is how you stop writing them

Module 4

Predicting a number

4/4

Linear models, regularisation, and the bias-variance trade-off made concrete.

  1. 14

    Linear regression

    A weighted sum that explains itself — and beats a random forest here

  2. 15

    Ridge and lasso

    Put a price on coefficients — one shrinks them, one deletes them

  3. 16

    Polynomials and the bias-variance trade-off

    1,329 features, a training R² of 0.89, and a test R² of −1.02

  4. 17

    Regression metrics

    MAE, RMSE, R² — and the residual plot that no number replaces

Module 5

Predicting a class

5/5

Logistic regression, boundaries, trees, forests — and living with imbalance.

  1. 18

    Logistic regression

    The sigmoid, log-odds, and the one line of maths that makes coefficients readable

  2. 19

    Decision boundaries and kNN

    The one hyperparameter that runs backwards, and a training score of exactly 1.0

  3. 20

    Decision trees

    A program made of if-statements — that predicts "on time" in every single leaf

  4. 21

    Forests and boosting

    Average many noisy trees, or stack many shallow ones — and still lose to logistic regression

  5. 22

    Class imbalance

    One keyword takes recall from 0.44 to 0.78 — and accuracy below the dummy

Module 6

Selecting and tuning

3/3

Searching hyperparameters without fooling yourself, and reading what the model learned.

  1. 23

    Searching hyperparameters

    The metric you pass does not report the winner — it decides it

  2. 24

    The honest estimate

    best_score_ is a winner’s score — and here the optimism is 0.0003

  3. 25

    Reading what the model learned

    Three importance methods, three different answers, and none of them is causation

Module 7

Without labels

2/2

Clustering and dimensionality reduction, and what they can and cannot tell you.

  1. 26

    Clustering

    k-means always returns clusters — which is not evidence that clusters exist

  2. 27

    Dimensionality reduction

    PCA costs us 0.07 AUC — because it has never seen the target

Module 8

Capstones

3/3

A project end to end, and a broken model to diagnose.

  1. 28

    Capstone: a classification project

    capstone

    End to end, with the threshold chosen from money rather than from 0.5

  2. 29

    Capstone: a regression project

    capstone

    Predict the number, diagnose the residuals, report in minutes

  3. 30

    Capstone: diagnose a broken model

    capstone

    Six faults in one notebook, and two that are real but too small to see

Module 9

The classic datasets

5/5

Iris, breast cancer, digits and diabetes — five projects on the datasets everyone quotes.

  1. 31

    Iris — and why it is too easy

    The most famous dataset in the field, and one flower is worth 3.33 accuracy points

  2. 32

    Breast cancer — check the label order

    0 is malignant, so every default metric answers the opposite question

  3. 33

    Digits — where kNN finally wins

    Images as 64 columns, a 10×10 confusion matrix, and PCA that actually pays

  4. 34

    Diabetes — a low ceiling, reported honestly

    R² 0.48 is the answer, and saying so is the deliverable

  5. 35

    Capstone: the model card

    capstone

    A dataset was deleted from scikit-learn. Write down what yours assumes.