MuhammadLab
Machine learning interactive tool

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.

Binary classificationWeight updatesDecision boundary

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

Pointx1x2ClassAction
P111Class -1
P21.52Class -1
P321Class -1
P444.5Class +1
P553.5Class +1
P64.55Class +1

Visualization

Decision boundary

-1-100112233445566-1-1-1+1+1+1test

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.

Browse ML resources