Drawing the Line: Classifiers
Loading simulation…
flagWhat you'll discover
- arrow_forwardExplain a classifier as drawing a boundary between groups
- arrow_forwardShow how a perceptron learns a linear decision boundary
- arrow_forwardDescribe what is meant by features in machine learning
- arrow_forwardRecognise when data is not linearly separable
Sort by drawing a line
Many machine-learning tasks come down to sorting things into groups: is this email spam or not, is this cell healthy or cancerous, is this image a cat or a dog? The simplest possible classifier, the perceptron, does this by drawing a single straight line through the data: points on one side are class A, points on the other are class B.
To draw that line, the perceptron needs to measure each example with numbers called features. To tell cats from dogs you might use "height" and "ear length" as two features, plotting each animal as a dot. The perceptron learns the line that best separates the cat-dots from the dog-dots. Drag the line in the simulation and watch the classification flip across it.
How the perceptron learns
The perceptron starts with a random line, which is almost certainly wrong. Then it looks at each point in turn: if the point is already on the correct side, nothing happens; if it is on the wrong side, the perceptron nudges the line slightly towards placing it correctly. After enough passes through the data, the line settles into a position that separates the groups — assuming such a line exists.
This elegant rule, invented in 1958, was the first machine-learning algorithm ever implemented in hardware. It cannot solve every problem (more on that next), but it captures the essence of all classifiers: find a boundary in feature space that sorts the examples correctly. Modern classifiers do the same thing, just with curved, high-dimensional boundaries learned by deep networks.
When a line is not enough
Some data simply cannot be separated by a straight line. The classic example is the XOR problem: four points arranged so that no single line can put the right pairs together. For years this stumped early neural network research, because a one-neuron perceptron provably cannot solve it.
The breakthrough was stacking perceptrons into layers — a multi-layer network, or multi-layer perceptron. With a hidden layer in between, the network can combine several straight lines into curved, complex boundaries, solving XOR and vastly more intricate problems. That insight, that depth creates power, is what eventually grew into the deep learning that runs modern AI. Toggle the "hidden layer" in the simulation and watch a curved boundary appear where no straight line could ever work.