What is machine learning?
Normal programs follow rules a person wrote. I'm different: show me examples and I'll figure out the rule myself. A crowd of monsters just arrived. Tap one to teach me!
A normal program
A person writes the rules. The computer just follows them.
Machine learning
We give examples with answers. The computer works out the rules. That rule-finder is called a model.
Try it: teach Robo a secret rule
Checkpoints — Robo's brain saved along the way. Tap one to look back.
How it works
Look
Robo sees the monster you tapped: how big, how blue, how spiky, how many eyes. Just numbers!
Guess
It multiplies each number by how much it cares about it, adds them up, and guesses.
Check
Then it gets the real answer and sees how wrong it was.
Tweak
It nudges its "how much I care" numbers a little, so next time it would be less wrong.
What just happened?
- Robo started knowing nothing, so its first guesses were coin flips.
- Every example taught it a tiny bit: the bars on the right grew toward the secret rule. And the whole crowd changed faces, even monsters Robo never saw.
- Nobody told Robo the rule. It learned it from examples. That's machine learning!
- The tricky "big AND blue" rule takes more examples, because Robo must notice two things at once.
The ways machines learn (this course)
For grown-ups: what's really going on
Robo is a logistic regression classifier, the simplest real ML model. Each monster is a feature vector x = [size, blueness, spikiness, eyes] in [0, 1].
- Guess:
p(friendly) = σ(w·x + b), where σ is the sigmoid. - Check: the loss is cross-entropy between
pand the true labely ∈ {0,1}. - Tweak: one step of stochastic gradient descent per example:
w ← w − η (p − y) x,b ← b − η (p − y). - Test score is accuracy on 60 fixed monsters Robo never trains on, so it measures generalisation, not memory.
- “Big AND blue” is still linearly separable, so logistic regression can learn it; a rule like “big XOR blue” would need a neural network (see Chapter 3).