← davidhaxton.co.uk

Ms Ellis wants a computer that can spot a cat in a photo.

Rules or examples?

There are two ways to build it. Write the rules yourself, or show it examples and let it find the pattern. Today you build both.

Start with the rules
This is what a computer sees: 576 numbers. Hover to read them.0.00
Part 1 of 4

The Rule Machine

Ms Ellis has 11 photos from the school photo competition. Someone has already recorded what can be seen in each one. Your job is to write the rule that decides which photos are cats.

The machine follows your rule exactly, and the table updates instantly.

A photo is a cat if it has all of:
6out of 11 correct
Rules tried: 1 of 3
WorstBest
8 / 11

The best any rule can do. The computer has tried every possible combination of these six rules: all 64 of them, shown as squares. Your current rule has a pink outline. The best rules have a white dot. Click any square to try that rule.

Now compare the rows for the cat sitting up, the fox, and the hare (marked in pink on the left edge of the table). Their data is identical. If the data cannot tell them apart, no rule written using that data ever can. Every rule that keeps the fox out also throws out a real cat.

Part 2 of 4

The Learning Machine

This machine has no rules at all. Nobody has told it what a fish looks like. You teach it with examples instead.

After training, every new drawing is turned into numbers and compared with your examples.

Draw a cat face 1 of 4
Examples: 0. Rules: 0.
Your drawing as the machine sees it: 784 numbers.
Draw something new.

Where your drawing lands

Each example is placed so that similar drawings sit close together. The pink lines join your drawing to the three examples it is most like. That is the whole trick: similar numbers, similar answer.

Try to break it

  1. Draw a fish facing the other way. Where does it land on the map?
  2. Draw a tiny star in one corner. Does size or position matter?
  3. Draw something that is none of the three, eg a house. The machine still picks one. Why can it never say "I do not know"?
  4. When it gets one wrong, teach it the right answer and draw a similar one again.

How honest is this machine?

This one keeps every drawing you gave it and compares new drawings with all of them. Large systems, such as the one behind Google's Quick, Draw!, learn from millions of drawings and keep only the patterns, not the drawings. The principle is the same: no rules, just examples. The map is flattened from 784 dimensions to two, so distances on it are only approximate.

Part 3 of 4

Rules or examples?

Drag each card into a box, or click a card and then a box. Some of these are not obvious. Decide anyway, then check.

Follows rules
A person wrote every instruction.
Learned from examples
It found the patterns in data.
Part 4 of 4

Exit question

Answer on your own. Write your reason before you look at the answer.

A spam filter was shown 10,000 emails, each already marked "spam" or "not spam". Does it follow rules or learn from examples?