Stage 1 of 4

Classic machine learning

From a straight line to a whole forest: linear and logistic regression, decision trees, k-means, SVMs, PCA, k-nearest neighbours, Gaussian discriminant analysis, random forests and gradient boosting. Every lab computes for real in your browser, checked against NumPy and scikit-learn.

algorithms
10
in every lab
2D + 3D
articles for every lab
EN / 中文

Live · computing in your browser

—

Algorithms in Classic machine learning

In the recommended learning order. Hover a card to replay how that algorithm computes.

  1. iter 0 · Σr² = 70.47iter 1 · Σr² = 31.50iter 2 · Σr² = 17.99iter 3 · Σr² = 13.15iter 5 · Σr² = 10.56iter 8 · Σr² = 9.94iter 13 · Σr² = 9.81iter 21 · Σr² = 9.80iter 34 · Σr² = 9.79QR · Σr² = 9.79min Σ rᵢ²
    01

    Linear regression

    Least-squares lines and planes: QR closed form and gradient descent; drag any point and it recomputes.

    2D3DOpen the lab
  2. iter 1 · L = 0.656iter 2 · L = 0.628iter 4 · L = 0.593iter 8 · L = 0.560iter 16 · L = 0.539iter 32 · L = 0.532iter 64 · L = 0.531Newton · L = 0.531σ(z)p = σ(w·x + b)
    02

    Logistic regression

    A probabilistic binary classifier: sigmoid, cross-entropy, gradient descent and Newton's method, threshold, confusion matrix and ROC.

    2D3DOpen the lab
  3. x₂ ≤ 0.76 ?
    03

    Decision tree

    CART grown one split at a time: Gini, entropy and MSE, the split search, tree diagram and cost-complexity pruning.

    2D3DOpen the lab
  4. iter 0iter 1iter 2iter 3iter 4iter 5min Σ‖x − c‖²
    04

    K-means clustering

    Lloyd's algorithm step by step: k-means++ seeding, Voronoi cells, elbow and silhouette, 100,000 points on the GPU.

    2D3DWebGPUOpen the lab
  5. SMO iter 1 · 2/‖w‖ = 2.77SMO iter 2 · 2/‖w‖ = 1.81SMO iter 3 · 2/‖w‖ = 2.41SMO iter 5 · 2/‖w‖ = 1.63SMO iter 8 · 2/‖w‖ = 1.65SMO iter 11 · 2/‖w‖ = 1.65SMO iter 14 · 2/‖w‖ = 1.65SMO iter 17 · 2/‖w‖ = 1.65max 2/‖w‖
    05

    Support vector machine

    Soft-margin SVM solved by SMO one α-pair at a time: margins, support vectors, kernels and the explicit feature map.

    2D3DOpen the lab
  6. iter 0iter 1iter 2iter 3iter 4v ← Cv / ‖Cv‖
    06

    Principal component analysis

    Principal components by power iteration: axes, projection, explained variance and reconstruction, in 3D and on the iris data.

    2D3DOpen the lab
  7. 0 / 71 / 72 / 73 / 74 / 75 / 76 / 77 / 7vote 0 : 2 : 5k = 7
    07

    k nearest neighbours

    k nearest neighbours: decision regions as k changes, distance balls, accuracy against k, a 20,000-point grid on the GPU.

    2D3DWebGPUOpen the lab
  8. n = 9n = 15n = 30n = 60n = 120n = 180P(c | x) ∝ P(c)·N(x; μ, Σ)
    08

    Gaussian discriminant analysis and naive Bayes

    Gaussian naive Bayes, LDA and QDA learned one sample at a time: ellipses, posteriors, boundaries and probability hills.

    2D3DOpen the lab
  9. T = 1T = 2T = 3T = 4T = 5T = 6T = 6(1/T) Σ treeₜ(x)
    09

    Random forest

    A random forest grown one tree at a time: bootstrap samples, random features, out-of-bag error and the averaged vote.

    2D3DOpen the lab
  10. m = 0m = 1m = 2m = 3m = 5m = 8m = 13m = 21m = 34m = 60F ← F + ν·h(x)
    10

    Gradient boosting

    Gradient boosting stage by stage: each small tree fits the residuals and the fit sharpens, in 1D and as a 3D surface.

    2D3DOpen the lab