Day 03 of 10

How Machines Learn: Data, Patterns, and Training

If a computer doesn't have a brain, how does it "learn" from examples?

Picture this: someone shows you ten photos, says "yes" to some and "no" to others, and never tells you why. After enough photos, you start guessing correctly before they answer — you found the pattern without anyone stating the rule out loud. That's almost exactly what a machine learning model does, and it's the core trick behind this entire field.

This particular flavor is called supervised learning: the model sees training data made of examples that are already labeled with the right answer (this email is spam / not spam, this photo is a cat / not a cat), and it adjusts itself, bit by bit, to get better at predicting the label on new, unlabeled examples. There's no understanding of "spam" or "cat" in any human sense — just a steadily improving guess based on which patterns in the data lined up with which labels in the past.

Not all learning comes with an answer key, though. Unsupervised learning hands the model a pile of unlabeled data and asks it to find structure on its own — like grouping customers into clusters based on shopping habits, with no one telling it what the groups should be ahead of time. And reinforcement learning is a third style entirely: instead of labeled examples, the system gets a reward or penalty for actions it takes (think of training a dog with treats), which is how systems learn to play games or control robots through trial and error.

Here's the part that surprises people: the model itself isn't the data, and it isn't really "thinking" — it's closer to a giant adjustable dial that's been tuned by exposure to thousands or millions of examples until its predictions are useful. Once that tuning is done, you've got a trained model that can take a brand-new input it's never seen and produce a prediction.

Today's activity puts you on the other side of that process: you'll be the one staring at labeled examples, hunting for the hidden rule, and feeling exactly how strange and probabilistic that kind of learning is — you'll be confident before you're certain, which is basically how every model works too.

Interactive Sandbox

Train a Real Classifier

This isn't a simulation of training — it's the actual perceptron learning rule running in your browser. Drag the boundary yourself, then watch the same algorithm converge on its own, one labeled example at a time.

!!!!!!!!!!!more exclamation marks ↑more links →
Not spam Spam Misclassified

Drag the boundary yourself and try to separate the two colors perfectly — that’s you doing what a model’s training loop does automatically. Then hit “Auto-train” and watch the perceptron learning rule nudge the line, one pass over the data at a time, toward the same answer.

45% correct · pass 0

Try It Yourself

Guess the Rule

Each example below is labeled with a checkmark or an X by a hidden rule. Study the pattern, write your best guess, then reveal the actual rule — exactly the process a model goes through during training, just slower and out loud.

Triangle, red, 3 sides?
Square, blue, 4 sides?
Triangle, blue, 3 sides?
Pentagon, red, 5 sides?
Triangle, green, 3 sides?
Hexagon, red, 6 sides?
Triangle, yellow, 3 sides?
Circle, red, 0 sides?

Want to go deeper?

Supervised Learning — Crash Course AI #2

For Teachers: Full Lesson Plan Detail
Objectives
  • Explain the basic training loop: input data, prediction, comparison, adjustment
  • Differentiate supervised, unsupervised, and reinforcement learning with examples
  • Identify what counts as "training data" for common AI tools
Key Vocabulary
Training DataSupervised LearningUnsupervised LearningReinforcement LearningModelPrediction
Lesson Flow

1. Warm-Up

"Guess the Rule" pattern game—students see labeled examples and try to find the pattern, mimicking how a model learns.

2. Direct Instruction

Walk through the training loop using a simple example, like an email spam filter: data in, guess, correction, repeat.

3. Guided Practice

Kinesthetic activity: students act out a "human neural network," sorting example cards into categories, getting feedback, and adjusting their rule.

4. Independent Practice

Worksheet matching real AI applications (recommendations, voice assistants, fraud detection) to the correct learning type.

Assessment: Exit ticket: explain in 2–3 sentences how a spam filter "learns" what spam looks like.