TwiddleLab / Artificial Intelligence / How a Neural Network Thinks
A Line Separates the Classes
What you will learn
- A line that splits the feature space into classes is a decision boundary.
- A classifier sorts a new point by the side of the boundary it lands on.
- A line is two numbers, y = m x + b. Learning means finding the m and b with the fewest mistakes.
- Some data can't be split by any straight line. That needs more than one line.
How the lesson goes
30 messages, turned into points. What would you draw to split them?
Orange rings are spam, green dots are normal. Draw a fence with your finger or mouse, then Check.
A machine uses a straight fence. Drag its right end.
Get it down to 2 mistakes or fewer. Points on the wrong side blink. Your fence is the dashed line.
Game: beat par. Both ends move, and you have 6 moves.
Par is 2 mistakes. Every drag of an end is one move.
Time to name what you built.
Tap to reveal.
A line that splits points into classes is a decision boundary.
A machine that sorts new things by their side of it is a classifier: above the line spam, below it normal.
Like any line, it is y = m x + b: a tilt m and a height b. Learning means finding the m and b with the fewest mistakes.
New mail is falling. Call each one before it lands.
Tap the side of your line where it will land: the spam side or the normal side.
How many mistakes does line A make?
Spam belongs above it. Put your marker on the scale, then Check.
Same trick, other data: apples and limes.
Both ends are free. This time aim for zero mistakes.
Now steer the line with its two numbers, like a machine does.
Turn m (the tilt) and b (the height) until the line makes 2 mistakes or fewer.
Break it: make the classes impossible to split.
Drag the circled spam point. After each drop the machine hunts for a straight line that still works.
Your line against the class.
Here's the line you built in the game. Compare its mistakes with everyone else's.
Previous lesson: Features as Coordinates · Next lesson: Measuring Wrongness · Part of the course: How a Neural Network Thinks
Lessons are interactive and need JavaScript. Turn it on to play them.