Supervised Learning & Model Selection

21 tutorials· Ordered reading path

Supervised learning is the workhorse of machine learning: give the model labelled examples and let it learn the mapping. This path covers the core algorithms and the practical skills you need to deploy them well.

You will implement linear regression five ways, classify text with TF-IDF, reduce dimensions with PCA and PLS, and learn to select, tune, and evaluate models rigorously. For neural networks and deep learning, see the dedicated Deep Learning path.

1

Linear Regression from Scratch: Five Solvers, One Answer

Solve linear regression five ways in Python: normal equation, gradient descent, SVD, scipy.optimize, and sklearn. Different maths each time, the same answer.

2

Convolutional Neural Networks from Scratch: Conv2d in NumPy

2D convolution from scratch in NumPy, verified against PyTorch's Conv2d, then a CNN trained on MNIST. Kernels, stride, padding, and feature maps explained.

3

Text Classification from Scratch: TF-IDF and Naive Bayes

Build a text classifier that sorts documents into 20 categories. How TF-IDF turns text into numbers and why Naive Bayes works despite its assumptions.

4

LSTM from Scratch: The Forget Bias Sets the Memory

Build an LSTM from scratch, check the NumPy cell against PyTorch and measure how forget bias changes recall across 100 sequence steps.

5

Transfer Learning for Text: Language Model to Sentiment

Fine-tune a pretrained language model on IMDb into a sentiment classifier: tokenisation, gradual unfreezing, and discriminative learning rates from scratch.

6

LDA vs PCA: Supervised vs Unsupervised Reduction

PCA vs Fisher's LDA on the Iris dataset. When unsupervised reduction fails, why labels matter, and the eigenvalue problem behind both methods.

7

PCR vs PLS: When Fewer Features Beat More

Principal Component Regression vs Partial Least Squares on the Hitters dataset. When discarding features helps predictions, and why PLS beats PCR.

8

Gaussian Process Regression: The Bayesian Approach to Curve Fitting

Gaussian process regressor from scratch in NumPy. How kernels encode smoothness, posteriors collapse with data, and GPs power Bayesian optimisation.

9

Support Vector Machines: A Sparse Kernel Machine Guide

Build an SVM from scratch with scikit-learn and a cvxopt dual QP. Max-margin geometry, the kernel trick, hinge vs cross-entropy.

10

Relevance Vector Machine vs SVM in Python

Build a relevance vector machine from scratch. The RVM gives sparser, calibrated alternatives to the SVM via ARD priors and evidence maximisation.

11

SMOTE vs Class Weights: Imbalanced Classification

Five strategies for imbalanced classification with scikit-learn and imblearn: downsampling, upsampling, SMOTE, and class weights, judged on precision-recall.

12

Anomaly Detection from Scratch: 3 Detectors Compared

Build three unsupervised anomaly detectors from scratch: Isolation Forest, One-Class SVM and an autoencoder. See why ROC-AUC lies on imbalanced fraud data.

13

Stacking and Ensemble Methods in Python

Bagging, AdaBoost, gradient boosting, stacking, and mixture of experts from scratch in NumPy, with XGBoost benchmarked. Why ensembles still win on tabular data.

14

Gradient Boosting: Fitting the Residuals, From Scratch to XGBoost

Boosting fits weak trees to the errors so far, one at a time. We animate the residual loop, derive it as gradient descent in function space, then XGBoost.

15

Random Forests from Scratch: Bagging and OOB Error

One decision tree overfits wildly. Average a hundred on bootstrap samples with random feature subsets and you get the no-tuning workhorse of tabular ML.

16

Hyperparameter Optimization: Grid vs Random vs Bayesian

Grid search, random search, and Bayesian optimisation on the same Random Forest. Why Bayesian optimisation learns from its own history and wins.

17

AIC and BIC: Choosing the Right Model Without Overfitting

AIC vs BIC explained: build both information criteria from scratch, see why they penalise complexity differently, and when to use each for model selection.

18

Model Calibration in Python: The Metric Decides the Method

Measure how five model families miscalibrate, then fix it three ways. On 200 calibration rows ECE and log loss pick different methods, and only one of them is right.

19

Conformal Prediction: 90% Coverage, 29% Where It Counts

Split conformal prediction in Python delivers exactly the coverage you ask for. Measured per class it gives 95% on the common ones and 29% on the rare.

20

Double Machine Learning in Python: Coverage Needs Good Fits

Build double machine learning in Python with cross-fitting and influence-function intervals. Measure a coverage failure and match DoubleML on 401(k) data.

21

Cox Proportional Hazards in Python with lifelines

Fit Cox proportional hazards in Python on real recidivism data: partial likelihood, hazard ratios, Schoenfeld diagnostics, and time-dependent covariates.

Related Tools

Stay in the loop

Get notified when new tutorials and deep-dives are published. No spam, unsubscribe anytime.

Supervised Learning FAQ

Common questions about this topic