Machine Learning
The core ideas, made visible — with scikit-learn.
Foundations
4/4What learning from data means, the estimator API, and the one rule you never break.
- 1
What learning from data means
Features, target, generalisation — and when to write a rule instead
14 min0/4 - 2
The estimator API
Four methods, two kinds of number, and one very informative underscore
13 min0/4 - 3
Train and test
Hold rows back, look at them once — and know how much luck is in the number
14 min0/3 - 4
Your first model
Eight lines, 79.6% accurate — and why that number should worry you
14 min0/3
Evaluating honestly
5/5Why accuracy lies, what to measure instead, and how to get a number you can trust.
- 5
Why accuracy lies
A coin flip finds more late deliveries than our model does
13 min0/3 - 6
The confusion matrix
Four numbers, and every classification metric is arithmetic on them
14 min0/3 - 7
Thresholds, ROC and PR
predict() hides a choice you should be making yourself
15 min0/3 - 8
Cross-validation
Take several measurements, report the spread, and keep the test set sealed
14 min0/3 - 9
Overfitting and underfitting
Two failures that look identical from a bad score, with opposite cures
15 min0/3
Preparing data
4/4Scaling, categories, missing values — and the pipeline that stops them leaking.
- 10
Scaling
Which models care about units, which do not, and why "always scale" is cargo cult
13 min0/3 - 11
Categorical features
Three unused text columns are worth more than any model change so far
15 min0/3 - 12
Missing values
Why the gap is there matters more than what you fill it with
14 min0/3 - 13
Pipelines and leakage
A 0.9989 AUC is a bug report, and a Pipeline is how you stop writing them
15 min0/3
Predicting a number
4/4Linear models, regularisation, and the bias-variance trade-off made concrete.
- 14
Linear regression
A weighted sum that explains itself — and beats a random forest here
14 min0/3 - 15
Ridge and lasso
Put a price on coefficients — one shrinks them, one deletes them
14 min0/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
15 min0/3 - 17
Regression metrics
MAE, RMSE, R² — and the residual plot that no number replaces
13 min0/3
Predicting a class
5/5Logistic regression, boundaries, trees, forests — and living with imbalance.
- 18
Logistic regression
The sigmoid, log-odds, and the one line of maths that makes coefficients readable
14 min0/3 - 19
Decision boundaries and kNN
The one hyperparameter that runs backwards, and a training score of exactly 1.0
13 min0/3 - 20
Decision trees
A program made of if-statements — that predicts "on time" in every single leaf
14 min0/3 - 21
Forests and boosting
Average many noisy trees, or stack many shallow ones — and still lose to logistic regression
15 min0/3 - 22
Class imbalance
One keyword takes recall from 0.44 to 0.78 — and accuracy below the dummy
14 min0/3
Selecting and tuning
3/3Searching hyperparameters without fooling yourself, and reading what the model learned.
- 23
Searching hyperparameters
The metric you pass does not report the winner — it decides it
14 min0/3 - 24
The honest estimate
best_score_ is a winner’s score — and here the optimism is 0.0003
13 min0/3 - 25
Reading what the model learned
Three importance methods, three different answers, and none of them is causation
15 min0/3
Without labels
2/2Clustering and dimensionality reduction, and what they can and cannot tell you.
Capstones
3/3A project end to end, and a broken model to diagnose.
- 28
Capstone: a classification project
capstoneEnd to end, with the threshold chosen from money rather than from 0.5
24 min0/3 - 29
Capstone: a regression project
capstonePredict the number, diagnose the residuals, report in minutes
20 min0/3 - 30
Capstone: diagnose a broken model
capstoneSix faults in one notebook, and two that are real but too small to see
22 min0/3
The classic datasets
5/5Iris, breast cancer, digits and diabetes — five projects on the datasets everyone quotes.
- 31
Iris — and why it is too easy
The most famous dataset in the field, and one flower is worth 3.33 accuracy points
14 min0/3 - 32
Breast cancer — check the label order
0 is malignant, so every default metric answers the opposite question
15 min0/3 - 33
Digits — where kNN finally wins
Images as 64 columns, a 10×10 confusion matrix, and PCA that actually pays
15 min0/3 - 34
Diabetes — a low ceiling, reported honestly
R² 0.48 is the answer, and saying so is the deliverable
14 min0/3 - 35
Capstone: the model card
capstoneA dataset was deleted from scikit-learn. Write down what yours assumes.
20 min0/3
