Your first model
A pizza-pricing machine
Imagine a tiny machine that guesses a pizza's price from its size. It has exactly one knob: how aggressively the price grows as the pizza gets bigger.
Turn the knob and watch two things move together — the line (the machine's rule) and its prediction for a 12-inch pizza. Try to land the prediction near the real price (the green ring).
Drag the knob — watch the line tilt and the prediction move.
A 12-inch pizza → predicted $24 · real $15
✗ too high — the rule is too aggressive
- Turn the knob up → the line gets steeper → prices rise faster.
- Turn it down → the line flattens.
- Somewhere in the middle, the line slides right through the dots — the machine's guesses match real pizzas.
That knob is the model's parameter. A model is just a rule with adjustable knobs — and you've been turning one. Written out, that's the whole definition: prediction = model(input, knobs). Once it's familiar, that gets shortened to f(x, w) — same idea, fewer letters.
Mental hooks (we reuse these all course): model = a recipe · parameter = a knob · prediction = a guess · data = real examples · training = tasting and adjusting.
Predict before you run
Commit to an answer before touching any code — guessing first is what makes it stick.
Check your understanding
1 / 2Keep the knob fixed and make the pizza bigger. The predicted price…
Now run the exact same machine — in real Python
The knob you turned is one line of code. Here it's called slope (in math, this number is the slope — same idea, fancier name). Run it, then change slope from 2 to 5 and run again.
Was the machine right?
A real 12-inch pizza costs about 24 — too aggressive. Turn the knob down near 1.25 and it lands on $15.
So a model can be wrong, and how wrong depends on the knob. Measuring that wrongness — and fixing it automatically — is the next two modules.
Why machine learning exists
You just tuned the knob by hand because you could see the right answer. But in real problems nobody knows the right knob in advance — there are too many knobs and too much data to eyeball.
Machine learning is the process of discovering the best knob values from data — automatically.
That's the whole game. The rest of the course is how.
What you just did
✅ Ran a model ✅ Changed a parameter ✅ Changed a prediction
That's machine learning. Modern AI models do the exact same thing — just with billions of knobs instead of one.
Play for two minutes
Curiosity builds intuition faster than instruction. In the code above, try:
slope = 0— what does the machine predict for every pizza?slope = -2— what could a negative knob even mean?size = 100— a giant pizza.slope = 1.25— the "just right" knob. How close does it get?