You don’t learn this
by watching videos.
You learn it by hand.
Margin is a 16-session course where every idea lands twice: once in a lesson you read, once in a Lab where you write the code and it runs in your browser. Exercise zero is below. Yes, right here on the landing page.
That instinct — move the thing, watch the error, move again — is gradient descent. The entire course is turning it into code you write.
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.
def step(w, b, lr=0.1): dw, db = gradient(w, b) return w - lr*dw, b - lr*db # the hillside, as three lines of numpy ▸ loss 4.218 → 0.392 → 0.041 ✓
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-10 algebra
- about 30 minutes per session
a Python installlabs run right herea GPUyour laptop is plentycalculusderived when needed, in phase 2
Do I need to know how to code?
A little helps, but Session 01 starts from the very first line of Python. If you can edit a formula in a spreadsheet, you can start.
How much math, honestly?
Grade-10 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 has a tutor that sees which step you’re on and nudges with a question — the way a good teacher does. It never hands you the answer.
Is it really free?
Yes. Margin was built for a school ML club and stays free while it grows. No card, no trial, no locked chapters.
Your turn.
Session 01 takes about thirty minutes and ends with your first running model. The line you just fit? You’ll teach a machine to do it.
Start Session 01 →