← Back to course
1/6
Week 05 Β· Rules or Learning?

Monday

When rules break
// Hand-written rules versus patterns found in data
⏱ about 20 min

Monday: When Rules Break

Rocket has been patching Sky Sorter all weekend. "Card E is a bright star, so I raised the brightness cut-off to 215."

Raven slides a new card across the console: brightness 205, size 6, no streak. "This is a planet. Your new rule calls it a star."

Rocket groans. "Every time I fix one card, another one breaks."

Nova drifts over the growing pile of patches. "You keep guessing the cut-off yourself," she says.

"What if the cards could show you where it belongs?"

Raven pulls out a fresh stack of cards, every one already labeled.

Two ways to build a sorter

There are two big ways to give a computer a sorting job.

Way 1: people write the rules by hand. The computer follows them exactly.

Way 2: the computer learns from data. It finds patterns in many labeled examples.

The second way is called machine learning. It is a kind of statistical inference that finds patterns in data.

Hand-written rulesMachine learning
Who chooses the rules?A personThe pattern found in the data
What does it need?A person who knows a rule for every caseA great many labeled examples
How do you fix a mistake?A person edits the ruleImprove the data, then learn again
Sky Sorter so farVersion 1, written by the crewComing this week
RULES OR LEARNING?
  • Read the question.
  • Tap your answer.
Rocket types "if brightness is 215 or more, then planet." Which way is that?
The crew counts 500 labeled cards to find the size where stars stop and planets start. Which way?
Machine learning is a kind of what?

Why patching rules gets hard

Rocket only looked at a few cards at a time, so each patch fixed one card and broke another.

When a job has many tricky cases, hand-written rules can grow long and fragile.

Learning from data looks at many examples at once. That is its big strength.

StatementTrue or false?
A hand-written rule is chosen by a person.?
Machine learning finds patterns in data.?
Rocket's 215 cut-off fixed every card.?
Hand-written rules can grow long and fragile when there are many tricky cases.?
WHY THIS EXERCISESeeing where rules break shows why learning from data can help.
Rocket's new cut-off for brightness was ____.
Raven's new planet card had brightness ____.
What do we call examples that already have the correct answer attached? Type the first word.
WHY THIS EXERCISELearning from data needs examples with their answers attached.
FROM GUESSING TO LEARNING
  • ?Find a new card that breaks the rule.
  • ?Guess a cut-off from one card.
  • ?Count which cut-off fits the most cards.
  • ?Gather many labeled cards.
WHY THIS EXERCISEMoving from one card to many cards is the heart of learning from data.

Great start! Tomorrow we look closely at how hand-written rules work and where they come from.