Skip to content
StackDecode
AI & ML Atlas
Neural NetworksalgorithmInteractive simulation

Perceptron Algorithm

The first learning neuron: nudges its weights whenever it classifies a point wrongly.

The idea

A perceptron outputs 1 if w·x + b is positive, otherwise 0. For every misclassified example it moves the weights toward the example (if it should have been 1) or away from it (if 0). If the classes can be separated by a straight line, this is guaranteed to find such a line in a finite number of steps.

w ← w + η (y − ŷ) x

Watch it run

This is a real computation, not a drawing. Pause, step, change the settings, or try new random data.

  • class 0
  • class 1
  • decision line

Weights start at zero: no line yet. The perceptron will check points one at a time.

1/4

The line is where the neuron's weighted sum crosses zero.

Step by step

  1. 1Start with small weights.
  2. 2Take a training example and compute the output.
  3. 3If it is wrong, add (target − output) × input to the weights.
  4. 4Cycle through the data until no mistakes remain.

Where it is used

Historic; the seed of every neural network, and a clear way to learn linear classification.

Watch out for

Never settles if the data is not linearly separable (it cannot learn XOR).

Related