Module 11

Supervised Machine Learning

How does an algorithm learn a predictive function from labeled examples?

lessons
24
duration
39 h 5 min
concepts
134
available in English
24 / 24
completed by you
0 of 24

Where it fits

Overview

Explore the major families of supervised learning—linear and logistic models, neighbors, generative classifiers, SVMs and kernels, trees and ensembles—and implement each from scratch before using a library. A full block covers gradient boosting, from AdaBoost and Friedman's derivation to the differences among XGBoost, LightGBM and CatBoost. Another block addresses honest evaluation: metrics, cross-validation without leakage, hyperparameter tuning, feature selection and probability calibration, which belongs in this module.

Why it matters

This is the most widely used toolbox in industry and quantitative finance: GBDTs dominate tabular data (risk, fraud, market signals and vulnerability prioritization), and softmax regression is the last layer of any network, including a GPT. Mastering leakage-free evaluation, calibration and tuning separates a publishable or deployable result from one that falls apart in production. SVMs, kernels and boosting also provide the conceptual foundation for m13 (learning theory), m14 (Gaussian processes) and m30 (reliability).

Lessons 24

  1. 01The supervised learning problem: tasks, losses and what each one estimatesFrames supervised learning as a choice of output space, predictor, and loss, with training minimizing its empirical version. Catalogs regression and classification losses and derives the conditional-distribution functional each estimates (mean, median, quantile, expectile, log-odds), because choosing a loss means choosing what to predict. Risk theory, the Bayes predictor, and surrogate consistency are formalized in m13; here they serve as modeling tools.Core80 min
  2. 02Linear regression: least squares, likelihood and iterative trainingA dense review of linear regression as the first supervised learner, bringing together least squares as projection (m02), stable numerical solutions (m09), and statistical inference (m05). Its machine-learning focus covers least squares as maximum likelihood under a noise model, centering and standardization, and iterative training with gradient descent and LMS when data do not fit in memory or arrive as a stream.Review75 min
  3. 03Polynomial regression, basis expansions and diagnosing overfittingTurn the linear model into a nonlinear approximator with feature maps φ(x): polynomials, interactions, and local bases. Use polynomial regression to observe overfitting directly and learn practical diagnostic tools: training, validation, and test splits, validation curves, and learning curves. Formal bias–variance decomposition belongs to m13; here the focus is reading it in real plots.Core80 min
  4. 04L2 regularization: ridge regressionIntroduces regularization as explicit complexity control through a penalty on parameter norm. Derives the closed-form ridge solution, interprets it via the SVD as a filter shrinking low-variance directions, defines effective degrees of freedom, and connects it to a Gaussian prior (MAP estimation). Ends with closed-form leave-one-out cross-validation for choosing λ without retraining.Core80 min
  5. 05L1 regularization: lasso, coordinate descent and elastic netExplains why the L1 norm produces sparse solutions, from diamond-corner geometry to subgradient optimality conditions. Implements lasso with coordinate descent, soft-thresholding, regularization paths, and warm starts as in glmnet, then extends it to elastic net for correlated variables. Concludes with the Laplace-prior MAP interpretation and limits of lasso as a feature selector.Core95 min
  6. 06Logistic and softmax regressionBuild logistic regression as a probabilistic model of P(Y = 1 | x), derive logistic loss as Bernoulli negative log-likelihood and prove convexity. Train from scratch with gradient descent and Newton (IRLS, whose general GLM framework appears in m05), survey scalable solvers, study separable data and extend to multiple classes with softmax, the output layer of neural classifiers.Core110 min
  7. 07Evaluation metrics: thresholds, rankings and costsOrganize metrics by what they measure: threshold-based decisions (confusion matrix, precision, recall, F1), threshold-independent ranking quality (ROC, AUC, precision-recall curves), and regression errors. Derive the optimal threshold from a cost matrix and address class imbalance using weights, resampling and prior correction. Probability metrics (log-loss, Brier) are covered in depth in the calibration lessons.Core100 min
  8. 08Cross-validation, data leakage and pipelinesStudy how to estimate model performance without misleading yourself: k-fold, stratified, grouped, repeated and time-aware validation; what cross-validation really estimates and why its variance has no unbiased estimator. The central section covers data leakage and prevention by encapsulating all preprocessing, including categorical encoding, in pipelines. Finish with nested cross-validation for selection and evaluation together.Core105 min
  9. 09Hyperparameter tuning: grid, random and bandit-based searchTreat hyperparameter tuning as optimization of a noisy, expensive black-box function. Compare grid and random search through low effective dimensionality, derive successive halving and Hyperband as adaptive budget allocation, and examine validation-set overfitting. Bayesian optimization is used as a tool; its theory is in m14. GPUCore85 min
  10. 10k-nearest neighbors and the curse of dimensionalityIntroduces the simplest nonparametric method and uses it to explain the Cover–Hart bound (1-NN asymptotically has at most twice the Bayes error), the role of metric and scaling, and the curse of dimensionality as distance concentration. Implements efficient exact search with KD trees and ball trees and analyzes when they stop working.Core85 min
  11. 11Generative classifiers: Naive Bayes and discriminant analysisChanges perspective from modeling P(y | x) to modeling P(x | y) and P(y), then applying Bayes. Develops Gaussian, multinomial and Bernoulli Naive Bayes with Laplace smoothing and log-space implementation, and linear and quadratic discriminant analysis. Compares generative and discriminative models using Ng and Jordan’s result and explains why Naive Bayes can classify well despite poorly calibrated probabilities.Core90 min
  12. 12Support vector machines: margin, duality and SMODerives SVM from the maximum-margin principle, introduces soft margin and hinge loss, and obtains the dual through KKT, revealing support vectors. Implements two real solvers: SMO (Platt) on the dual and Pegasos (stochastic subgradient) on the primal. Prepares for kernels by showing that the dual uses only dot products between examples.Core110 min
  13. 13Kernels: nonlinear SVMs, support vector regression and NyströmGeneralize linear models to feature spaces of arbitrary dimension with the kernel trick. Recognize and construct valid kernels, apply the trick to SVM and support vector regression, and address quadratic or cubic cost in n with the Nyström approximation. RKHS theory, the representer theorem, kernel ridge and random Fourier features are developed in m13.Core105 min
  14. 14Decision trees: CART from scratchBuild classification and regression trees with CART: greedy recursive partitions minimizing impurity (Gini, entropy, variance). Implement efficient split search by sorting once per feature, handling categorical and missing values, and cost-complexity pruning. Explain tree instability, the flaw bagging and boosting turn into a strength.Core110 min
  15. 15Bagging and random forestsTurn tree instability into accuracy by averaging many trees trained on bootstrap resamples. Derive the variance of a correlated-predictor average, explaining why Random Forest decorrelates trees by sampling features per node. Study out-of-bag estimation, impurity importance and its biases, and extremely randomized variants.Core100 min
  16. 16Boosting: AdaBoost and forward stagewise additive modelingAnswer Kearns and Valiant's question—can weak learners be combined into a strong one?—with AdaBoost, and reinterpret it with Friedman, Hastie and Tibshirani as stagewise additive modeling minimizing exponential loss. Prove the exponential training-error bound, discuss margin explanations for AdaBoost's unexpectedly limited overfitting and their limits under label noise.Core95 min
  17. 17Gradient boosting: gradient descent in function spaceDerive Friedman’s gradient boosting as functional gradient descent: at each stage fit a regression tree to pseudo-residuals (negative loss gradients evaluated on the data) and optimize each leaf value. Instantiate the algorithm for squared, absolute, Huber, quantile and logistic losses, and introduce practical regularizers: shrinkage, stochastic subsampling and early stopping.Core110 min
  18. 18Second-order boosting: deriving XGBoostDerive XGBoost from its regularized objective: second-order Taylor approximation of loss, optimal leaf weight w* = -G/(H + λ), exact split gain and pruning with γ. Then study the algorithmic and systems choices behind its scalability: exact versus Hessian-weighted quantile split search, default direction for sparse or missing values, column blocks and cache-aware access. GPUAdvanced115 min
  19. 19LightGBM and CatBoost: histograms, sampling and ordered boostingStudy the two major responses after XGBoost. LightGBM addresses computational cost through histograms and subtraction, leaf-wise growth, GOSS (gradient-based sampling) and EFB (exclusive feature bundling). CatBoost addresses statistical bias: label leakage in target statistics and prediction shift from data reuse, solved with ordered statistics and ordered boosting on symmetric trees. GPUAdvanced120 min
  20. 20Gradient boosting in practice: comparison, tuning and constraintsTurn earlier theory into engineering judgment. Compare XGBoost, LightGBM, CatBoost and HistGradientBoosting in design, defaults and behavior; establish a staged tuning recipe with early stopping and a controlled budget; and introduce monotonic and interaction constraints, DART and custom losses. Finish with a reproducible benchmark on the local GPU. GPUAdvanced100 min
  21. 21Calibration: definition, reliability diagrams and proper scoring rulesThe platform’s home lesson for calibration. Define precisely what classifier calibration means (binary, top-label, classwise and canonical), how to measure it (reliability diagrams, ECE and its biases), and why strictly proper scoring rules (log loss, Brier) reward both calibration and discrimination, as Murphy’s decomposition shows. Catalog the characteristic miscalibration signatures of model families studied in this module.Core100 min
  22. 22Recalibrating classifiers: Platt, isotonic, beta and temperature scalingDevelop post-hoc recalibration methods and when to use each: Platt scaling, isotonic regression using PAV, beta calibration and multiclass temperature scaling. Emphasize the correct protocol (separate calibration data or cross-fitting), prior correction after resampling, and the tradeoff between calibrator flexibility and overfitting.Advanced100 min
  23. 23Feature selectionSystematize selection of useful feature subsets: filters (univariate statistics, mutual information, mRMR), wrappers (sequential selection, recursive elimination) and embedded methods (lasso, tree importance). Focus on two errors invalidating results—selection outside validation and unstable subsets—and their controls: stability measures and stability selection, with a bridge to m05 knockoffs for false-discovery-rate control.Core95 min
  24. 24Frontier: trees versus deep learning and tabular foundation modelsExamine the open question of why GBDTs still dominate typical tabular data and what is changing. Analyze benchmarks and inductive biases identified by Grinsztajn et al., the evolution of tabular networks, tabular foundation models using in-context learning after synthetic pretraining (TabPFN), and distributional boosting (NGBoost). Learn to read these papers critically and reproduce comparisons locally. GPUResearch100 min

Module capstone

Your tabular ML engine: from CART to a calibrated second-order GBDT

Build a small library of your own with a scikit-learn-style API: regularized linear and logistic regression, CART, Random Forest and a second-order GBDT with histograms, leaf-wise growth, early stopping, monotonic constraints and custom losses, plus a calibration module (Platt, isotonic, temperature) and an evaluation module with leakage-free nested CV. Apply it to a public problem with class imbalance and high-cardinality categoricals (for example an OpenML fraud or credit-risk dataset), compare it with XGBoost, LightGBM and CatBoost using the same tuning budget, and deliver a reproducible report with ranking metrics, your own rules, reliability diagrams, a cost-optimal threshold and feature-selection stability analysis.

Check what you already know

  • Derive which functional of the conditional distribution each loss estimates (mean, median, quantile), and which probability each surrogate for 0-1 loss recovers.
  • Derive least squares as Gaussian maximum likelihood and set the gradient descent learning rate from the spectrum of XᵀX/n.
  • Read learning and validation curves to diagnose high bias or high variance.
  • Interpret ridge through the SVD and calculate its effective degrees of freedom and closed-form LOOCV.
  • Derive the lasso coordinate update using soft thresholding.
  • Derive the gradient and Hessian of logistic regression and explain what happens with separable data.
  • Choose between ROC and precision–recall for rare classes and set the optimal threshold from a cost matrix.
  • Detect data leakage and build nested cross-validation with preprocessing inside the pipeline.
  • Explain why random search beats grid search and how Hyperband allocates its budget.
  • State the Cover–Hart bound and explain distance concentration in high dimensions.
  • Prove that LDA with shared covariance produces linear boundaries.
  • Derive the soft-margin SVM dual and identify the types of support vectors.
  • Check numerically whether a similarity is a valid kernel and kernelize an algorithm that only uses dot products.
  • Implement CART's search for the best split in O(n log n) per feature.
  • Derive the variance of an average of correlated predictors and explain the role of max_features.
  • Prove the exponential bound on AdaBoost training error.
  • Calculate pseudo-residuals and optimal leaf values for squared, absolute and logistic losses.
  • Derive the optimal leaf weight w* = -G/(H + λ) and XGBoost split gain.
  • Explain GOSS, EFB, leaf-wise growth and CatBoost ordered boosting.
  • Design a fair benchmark of XGBoost, LightGBM and CatBoost and impose monotonic constraints on a GBDT.
  • Build reliability diagrams, estimate ECE and decompose the Brier score.
  • Implement Platt scaling and isotonic regression with PAV using a leakage-free protocol.
  • Integrate feature selection into the pipeline and measure its stability.

References