Part I · Chapter 1

Rules vs. Examples

How a machine learns a pattern by looking instead of being told a recipe.

For most of computing history, teaching a machine to do a job meant writing a strict recipe. Every single step had to be spelled out in advance, leaving zero room for guesswork. That works wonders for balancing a checkbook or running an elevator.

Now imagine you run a fruit-sorting shed. On a conveyor belt roll two kinds of fruit: crisp blue plums and sweet gold oranges. A sensor measures two simple things about each piece of fruit: how large it is, and how ripe it is.

The Trouble with Rigid Recipes

If you try to write a hand-crafted rule, it sounds sensible at first: "If the fruit is larger than this mark, and riper than that mark, call it a gold orange. Otherwise, call it a blue plum."

The trouble is that nature rarely lines up with neat rectangular boxes. What if a small, extra-ripe fruit is still a gold orange, while a huge, tart fruit is still a blue plum? The real dividing line runs at a slant—and a rigid box rule can only chop straight up and down or straight across.

Core Idea

Instead of hand-writing a brittle checklist of cutoffs, you can show the machine labeled examples and let a flexible divider tilt, slide, and settle until it separates the two sides on its own.

Interactive The Rigid Recipe vs. The Flexible Learner
Drag the cutoffs to try sorting every fruit cleanly
Size Cutoff Medium
Ripeness Cutoff Medium
Sorted right: 18 out of 22
Accuracy

Notice what happened when you switched to Learn from Examples. Nobody told the machine what angle to pick. When you drop a new fruit onto the board, the glowing line senses the mismatch and quietly tilts to accommodate the new evidence.

You didn't write a recipe for fruit. You built a learner—and let the examples write the rule for you.

What Happens When Examples Are Few vs. Many?

Learning from examples has a catch: the machine only knows what you have shown it so far. If you hand it just two pieces of fruit—one blue and one gold—dozens of wildly different dividing lines could separate them. The machine has to guess among all of them, and its guess will wobble wildly depending on which two fruits happened to arrive first.

Show it six fruits, and the wild angles get ruled out. Show it twenty-five, and the haze of doubt collapses into a single, steady border. Even then, notice one quiet habit baked into our learner: it always reaches for a straight line rather than a squiggly loop. That simple preference helps it make sensible guesses in empty parts of the map it has never visited.

Interactive Few Examples vs. Many Examples
Slide to reveal more fruits—or click the canvas to inspect a spot
Examples Shown 2 fruits
Certainty: Shaky — many lines still fit
Steadiness
Takeaway

A learning machine flips traditional programming upside down: instead of hand-coding fixed rules, you feed it labeled examples and let a flexible shape adjust to fit them. Few examples leave room for doubt; abundant examples pin down the true pattern.

In the Wild
Curious what researchers and engineers call these ideas?
Learning from Examples
Supervised Learning
Teaching a system by showing it inputs paired with the right answers (like blue plum vs. gold orange).
The Divider / Guesser
Model
The adjustable geometric rule—like our tilting line—that turns measurements into a decision.
Hidden Assumption of a Straight Line
Inductive Bias
The built-in preference for certain shapes (such as straight borders) that guides guesses in unseen territory.
Past Examples
Training Data
The collection of labeled cases the machine studies to shape its border before facing new arrivals.