💡The Big Idea: Rules vs. Examples
Traditional software follows a recipe you write: "IF the email contains 'free money' AND 'click here', mark it spam." That works fine — until the spammers swap "free money" for "complimentary funds." You'd have to keep updating your rules forever.
Machine learning flips the script. Instead of writing rules, you hand the computer thousands of labelled examples (spam / not-spam) and let it figure out the rules itself by looking for patterns.
| Traditional Programming | Machine Learning |
|---|---|
| You write the rules | The machine discovers the rules |
| Input + Rules → Output | Input + Output → Rules |
| Breaks when rules change | Adapts with new data |
| Great for simple logic | Great for complex patterns |
🍦Three Flavours of Machine Learning
"Machine learning" isn't one thing — it's a family of approaches that differ in how much guidance the algorithm gets from humans.
Supervised Learning
Learning from labelled examples — like practising with flashcards that have the answer on the back. Every training example comes with the right answer.
Everyday example: Email spam filter, house price prediction, image recognition.
Unsupervised Learning
Finding patterns and groups in data that has no labels — like sorting a jumbled drawer into piles that feel similar, without anyone telling you the categories.
Everyday example: Customer segmentation, topic detection in news, anomaly detection.
Reinforcement Learning
Learning through trial, reward and punishment — exactly like training a dog with treats. The agent tries actions; good outcomes give a reward; bad ones give a penalty.
Everyday example: Game-playing AIs (Chess, Go), robot locomotion, recommendation feeds.
🔄The Training → Prediction Loop
Every supervised ML system goes through two distinct phases: training (learning from data) and prediction / inference (applying what was learned to brand-new inputs).
Collect Data
Gather labelled examples — the raw material of learning.
Train
Feed examples to the algorithm; it adjusts its internal rules to minimise mistakes.
Evaluate
Test on unseen examples to measure how well it generalises.
Predict
Deploy: give the model a new input and let it produce an answer.
The key challenge is generalisation: the model must work well on examples it has never seen, not just the ones it trained on.
Imagine a 2-D world where every fruit has a size (x-axis) and a sweetness (y-axis). Pick a label, click on the canvas to drop labelled training examples, and watch the decision boundary emerge in real time.