ML 101

Labs & Demos

Interactive pages for this course. Every number on them is computed in your browser — nothing is a recorded animation, and nothing calls out to a server.

12 labs · 12 interactive demos
How to read these. Each page states which of its numbers are computed, which come from a published figure, and which are illustrative. Several were generated with AI assistance and say so on the page. They are teaching instruments, not measurements of real hardware.

Labs

Lab: ML Playground

Watch precision and recall pull apart

M1Lab4 steps
What you will do
  1. The confusion matrix, at t = 0.50
  2. Raise the threshold: recall drops
  3. F1: one number for both
  4. The base-rate trap

Lab: Linear Model Explorer

Watch bias fall as variance rises

M2Lab4 steps
What you will do
  1. The noise floor you cannot beat
  2. Too simple: low variance
  3. Too complex: variance takes over
  4. Ridge pulls variance back

Lab: Tree Visualizer

Measure a node's impurity, then split it

M3Lab4 steps
What you will do
  1. Gini of a 3-to-1 node
  2. Entropy of the same node
  3. Information gain of a clean split
  4. The greedy trap: XOR at depth 1

Lab: SVM Visualizer

Find the widest corridor, then bend it

M4Lab4 steps
What you will do
  1. The margin of the two-point set
  2. Relax C: the margin widens
  3. A deep interior point is not a support vector
  4. The kernel trick: RBF wraps a ring

Lab: Clustering Explorer

Score a clustering, then let density find its own groups

M5Lab5 steps
What you will do
  1. Inertia of two far-apart blobs
  2. Its silhouette score
  3. The elbow: inertia only falls as k rises
  4. DBSCAN: an isolated point is noise
  5. The exact minPts boundary

Lab: CNN Feature Visualizer

Slide a kernel, then watch a feature map form

M7Lab6 steps
What you will do
  1. Size of the conv map
  2. Size after max-pool
  3. Sobel-x fires at the edge
  4. …and is silent where it is flat
  5. ReLU zeroes the negatives
  6. Max-pool takes the max, not the mean

Lab: Sequence Prediction

Count characters, then predict the next one

M8Lab6 steps
What you will do
  1. The add-k floor for an unseen char
  2. …and the seen sibling
  3. An unseen context backs off to 1/V
  4. Perplexity of a perfectly predictable run
  5. A uniform unigram scores V
  6. Higher order lowers training perplexity

Lab: Attention Visualizer

Turn logits into a distribution

M9Lab4 steps
What you will do
  1. A softmax is a distribution
  2. Raise T: the odds flatten
  3. Greedy ignores temperature
  4. Top-k keeps, then renormalises

Project: End-to-End ML Project

One task, many models, one honest score

M10Lab4 steps
What you will do
  1. Model A: a greedy decision tree
  2. Model B: a linear SVM on a ring
  3. Model B, kernelised: RBF wins the ring
  4. Evaluate: accuracy is not enough

Lab: Transfer Learning Workshop

Reuse frozen features, or learn from scratch?

M11Lab5 steps
What you will do
  1. Transfer accuracy with few labels
  2. …versus from-scratch at the same n
  3. The frozen map is deterministic
  4. The gap shrinks as labels grow
  5. With plenty of labels, the edge nearly vanishes

Demos

Decision-tree sandbox

From lesson Decision Trees

Build a decision tree on a small 2D dataset: Gini impurity, entropy and the information gain of every candidate split are computed, and the axis-aligned decision boundary is drawn by running the tree's own predict() over a grid. Set the depth, min-samples and criterion, and watch it overfit noise.

M3 · L1AI-generated

SVM visualizer

Train a soft-margin SVM with a real dual solver (simplified SMO): the weight vector, bias, margin width 2/||w|| and support vectors are all solved for, and the boundary and margins are drawn from the decision function. Turn C, switch to the RBF kernel and tune gamma, and watch the margin, the support vectors and the C-sweep respond.

M4 · L1AI-generated

Clustering explorer

From lesson Clustering

Run a real K-means (Lloyd with a k-means++ start) or DBSCAN on a seeded 2D dataset: the assignment, centroids, core/border/noise labels, inertia and silhouette are all computed. Switch to the moons or rings to watch K-means cut across a shape DBSCAN wraps, and read the elbow and the k-distance graph.

M5 · L1AI-generated

CNN feature visualizer

Apply a fixed, named convolution kernel (Sobel, Laplacian, blur, sharpen, identity) to a small grayscale image, then ReLU, then 2x2 max-pool: every feature map is real 2D-convolution arithmetic, never sketched. Set padding, stride and a second conv layer, and watch the spatial dimensions shrink stage by stage while each kernel detects edges, smooths or sharpens.

M7 · L1AI-generated

Sequence-prediction sandbox

From lesson Sequence Modeling

Build a character-level n-gram language model on a built-in text corpus: the add-k smoothed next-character distribution, the training and held-out perplexity (in bits), and seeded sample text are all computed from real counts -- no neural network. Set the order, smoothing k and temperature, drop k to 0 and watch held-out perplexity blow up, and read the generated text as texture.

M8 · L1AI-generated

Transfer Learning Workshop

Demonstrates the transfer-learning MECHANISM on a small 2D task: a fixed seeded feature map (a synthetic STAND-IN for features a big model would have learned on a large related dataset, NOT real pretrained weights) is frozen and only a linear head is trained, versus a network trained from scratch and one fine-tuned from the frozen start. The head, both networks, every accuracy and the accuracy-vs-labels curve are computed; with few labels the frozen features win and the gap shrinks as labels grow.

M11 · L2AI-generated