Interactive machine-learning laboratory

A model draws a line. Reality asks whether it generalizes.

Build datasets, train three classifier families, and inspect the boundary they learn. The goal is not merely high training accuracy. It is a decision rule that still works on examples the model never saw.

Training fit is not generalizationNoise tests flexibilityRegularization limits complexityTest data estimates transferConfidence is not correctnessTraining fit is not generalizationNoise tests flexibilityRegularization limits complexityTest data estimates transferConfidence is not correctness

Shape the data. Watch the boundary answer.

Blue and red spheres are labeled examples. The tiled field is the classifier's prediction surface: color is the predicted class, while tile height shows confidence.

class Aclass Bdecision surface
few80
clean20%
flexible35%
Training accuracy50%
Test accuracy50%
Generalization gap0 pt
Model complexityLow

Every boundary is an assumption about what nearby examples mean.

The supervised-learning contract

Training data pairs inputs with labels. A classifier searches for parameters or a comparison rule that maps inputs to labels. The data does not uniquely determine that rule: infinitely many boundaries can memorize a finite sample. The model family and regularization decide which solutions are preferred.

fit + constraint = inductive bias

What the height means

Tall tiles indicate stronger confidence according to the current model. A tall wrong tile is not a contradiction. It is evidence that confidence reflects the model's internal score, not guaranteed truth.

Underfitting

The boundary is too simple for the pattern. Training and test accuracy are both poor. More data alone may not repair a model family that cannot represent the geometry.

Useful fit

The model captures stable structure. Training and test scores are both strong, and their difference remains modest across new samples.

Overfitting

The model follows sample-specific noise. Training accuracy rises while test accuracy stalls or falls, producing a widening generalization gap.

Three ways to partition the same space

Logistic linear

Learns one weighted plane. Its strong bias makes it data-efficient and interpretable, but it cannot represent XOR or concentric rings without transformed features.

One global boundary

Nearest neighbors

Stores examples and predicts from local votes. Small k can follow intricate shapes and isolated noise; larger k smooths the field but can erase minority structure.

Local memory

Radial basis

Measures distance from class centers through bell-shaped kernels. Kernel width controls whether influence is narrow and fragmented or broad and smooth.

Curved similarity
A reliable experiment

Measure what the model did not optimize.

Evaluation is a design discipline. A held-out score is meaningful only when the split resembles the deployment population and no test information leaked into training choices.

Split before tuning

Training examples update model parameters. Validation examples choose hyperparameters such as regularization and neighborhood size. Test examples estimate final performance after choices are frozen.

  • Keep duplicates and related records in the same split.
  • Preserve time order when predicting the future.
  • Stratify when rare classes matter.

Stress the geometry

Switch among blobs, XOR, and rings. A method that excels on one geometry may fail on another because its representation encodes a different assumption about separability and locality.

  • Add noise gradually instead of testing only clean data.
  • Repeat with smaller samples.
  • Inspect where errors concentrate, not only the average.

Read the gap carefully

A large train-test gap suggests variance, leakage, or distribution mismatch. A small gap can still hide universal failure when both scores are low. Always interpret the gap beside the absolute scores and class-specific errors.

Questions worth asking

Does the most complex boundary always overfit?

No. Complexity is relative to data volume, noise, and the true pattern. A flexible model can generalize when enough representative data and appropriate regularization constrain it.

Why use a separate test set?

Repeatedly checking a test set influences decisions and gradually turns it into training information. A final untouched set provides a less biased estimate of performance on future samples.

Is confidence calibration shown here?

The tile height visualizes raw model confidence, not a calibrated probability. Calibration requires comparing predicted probabilities with observed frequencies on held-out data.

What should I inspect beyond accuracy?

Use precision, recall, false-positive costs, subgroup performance, calibration, robustness under shift, and uncertainty. The relevant metric depends on the consequence of each error.

Use models as instruments, not oracles.

Explore SuperPowers workflows that turn explicit goals into inspectable agent actions, from research and computer use to complete website generation.

Explore SuperPowersBuild websites with an agentComputer-use cache