The math behind machine learning, from y = mx + b to ChatGPT.
Margin is a 16-session course for high school students. Each session has a lesson to read and an interactive where you move the numbers and see what the math does. You can try the first one below.
That instinct (move the thing, watch the error, move again) is gradient descent. The entire course is turning it into math you can see and use.
What you just did, on paper
You moved two numbers
The line is y = wx + b. Dragging the handles changed the weight w and the bias b, the same two numbers a model tunes.
A number graded you
The loss measured how wrong the line was, every frame. You steered by it without thinking. That number is the loss function, the heart of all training.
You minimized it
Nudge, check, nudge again. Done by a formula instead of a hand, that’s gradient descent. It trains everything from this line to ChatGPT.
Every concept lands twice.
Rolling downhill
Imagine standing on a hillside in fog. You can’t see the valley, but you can feel the slope under your feet. Step downhill. Re-check. Step again. The slope is the derivative; the stepping is learning.
16 sessions, five phases.
Some ideas you have to poke.
Alongside the sessions: standalone simulations. No progression, no score. Just the machinery, with the cover off.
- a browser (this one’s fine)
- grade-9 algebra
- about 30 minutes per session
programming experienceit’s the math, not the codea GPUyour laptop is plentycalculusderived when needed, in phase 2
Do I need to know how to code?
No. Margin is about the mathematics behind machine learning. There’s no coding in the club. If you can edit a formula in a spreadsheet, you can start.
How much math, honestly?
Grade-9 algebra gets you through phase 1. Derivatives show up in phase 2 and are built on the page when they do. Nothing is assumed, nothing is skipped.
What happens when I get stuck?
Every Lab walks you through one step at a time, and the club is there in the room when you want a person to ask.
Your turn.
Session 01 takes about thirty minutes and ends with your first real dataset. The line you just fit? You’ll learn the math a machine uses to fit it.
Start Session 01 →