Machine learning, made visual

CodeWithPurpose lessons that explain core ML ideas through live demos and clear visuals. Click any topic to explore — no setup required.

Student exploring machine learning with CodeWithPurpose
FoundationsInteractive

What Is Machine Learning?

Some problems cannot be solved by writing rules, no matter how many you write. Stack rules one at a time and watch each one buy you less than the last.

10 min read

FoundationsInteractive

Features and Labels

Data does not arrive ready to learn from. See how two measurements that are each useless on their own combine into one that works.

11 min read

FoundationsInteractive

How a Model Learns

Learning sounds mysterious. It is not. Drag one number, watch total error rise and fall, and find the bottom of the bowl yourself.

12 min read

FoundationsInteractive

Classification vs Regression

Categories or numbers? The line between them is a choice you make — and chopping a number into categories can make your accuracy look better while the model gets less useful.

11 min read

FoundationsInteractive

Train/Test Split

A model graded on the data it studied will always flatter itself. Re-roll the split and watch the score you would have reported swing by six points.

12 min read

FoundationsInteractive

Overfitting and Underfitting

The central failure of machine learning. Add bends to a curve until it passes through every training point — and gets dramatically worse at everything else.

12 min read

ClassificationInteractive

Measuring a Model

Accuracy is the first number everyone reaches for and the first one that will mislead you. Drag a decision threshold and watch precision and recall trade against each other.

13 min read

AlgorithmsInteractive

k-Nearest Neighbours

A model that learns nothing at all, and still beats a careless one. Move a student across the chart and watch five neighbours vote on their future.

12 min read

AlgorithmsInteractive

Decision Trees

Twenty questions, asked in the right order. Pick the split yourself, see how much confusion each one clears, and find out why the greedy choice is not always the best one.

13 min read

AlgorithmsInteractive

Random Forests

One deep tree memorises its training data. Two hundred of them, each deliberately handicapped, do not. Add trees one at a time and watch the boundary settle down.

12 min read

EvaluationInteractive

Cross-Validation

Chapter five left you with a score that was partly luck. Rotate which slice is held back, average the five results, and watch a lottery ticket turn into a measurement.

12 min read

EvaluationInteractive

Data Leakage

The bug that makes your model look brilliant in testing and useless in production. Four realistic pipelines, one of them honest — find the leak before you scroll to the answer.

13 min read

EvaluationInteractive

Class Imbalance

When one answer is rare, accuracy stops meaning anything and most fixes quietly make the model worse. Rebalance a fraud dataset and watch what each repair actually costs.

12 min read

EvaluationInteractive

Baselines

Before you can say a model is good you need something for it to be better than. Race four models against a rule a child could write, and find out which ones lose.

11 min read

Open source

Your lesson goes here

Every lesson here was written by a student. Propose your own topic, or fix one that confused you. Drafts stay invisible until they are ready, so nothing you start can break the site.

Keep building your ML foundation

These lessons are part of CodeWithPurpose's free learning library — built by students, for students, everywhere.