Perceptron Algorithm Interactive Demo
See how a perceptron learns a linear decision boundary by updating its bias and weights whenever it misclassifies a training point.
Current model
b=-0.1, w1=-0.1, w2=-0.1
6
Points
30
Steps
100%
Final fit
Training configuration
Build a tiny classifier
Add training point
| Point | x1 | x2 | Class | Action |
|---|---|---|---|---|
| P1 | 1 | 1 | Class -1 | |
| P2 | 1.5 | 2 | Class -1 | |
| P3 | 2 | 1 | Class -1 | |
| P4 | 4 | 4.5 | Class +1 | |
| P5 | 5 | 3.5 | Class +1 | |
| P6 | 4.5 | 5 | Class +1 |
Visualization
Decision boundary
Model equation
sign(-0.1 + -0.1x1 + -0.1x2)
Step-by-step training
Inspect each update
Step 1 of 30
Epoch 1, point (1, 1) with true label -1. The model predicted 1. Weights were updated because the point was misclassified.
Update rule
activation = b + w1*x1 + w2*x2 = 0
before: b=0, w1=0, w2=0
after: b=-0.1, w1=-0.1, w2=-0.1
update: w = w + eta*y*x
Try prediction
Classify a new point
Current step predicts
Class -1
Final model predicts Class +1.
Concept summary
The perceptron is the simplest neural classifier.
It works well when two classes can be separated by a line. If the data is not linearly separable, the updates may keep bouncing around instead of converging. That limitation is exactly why later models use margins, kernels, multilayer networks, and smoother loss functions.