Perceptron (Neural Networks)

Declared dead in 1957, today the basic building block of every deep learning model. In action here.

What is a Perceptron?

AnalogyDefinition

Imagine a bouncer at an exclusive club. He looks at a checklist with various criteria: Is the person on the guest list? Are they wearing appropriate clothing? Do they have an invitation?

Each criterion has a different importance (weight). The guest list might count more than the clothing. The bouncer adds up all the weighted points, and if the sum exceeds a certain threshold, he says 'YES, come in!' - otherwise 'NO, stay out!'. That's exactly how a perceptron works.

Interactive Perceptron

IntroductionUnderstanding the Neuron

Welcome! A perceptron is the simplest neural network - a single artificial neuron. It takes inputs (x₁, x₂), weighs them (w₁, w₂), adds a bias (b), and then decides: 1 or 0.

What happens on the field

A single artificial neuron learns to separate two groups of points — just by moving a boundary. Here is what you see while it does.

What you see
A square field with points in two kinds: empty circles (○) and filled circles (●). A straight line runs across the field — the dividing line. It splits the field into two halves, one for each kind.
What happens
With every learning step the line tilts and shifts a little. When a point sits on the wrong side, the line turns toward it. Step by step the line moves into the position where both kinds are cleanly separated.
What you can do
Drag the line by its two handles with the mouse, or let the neuron learn on its own: step by step or automatically. A slider sets the pace, and you can switch between the tasks AND, OR and XOR.
What to watch for
This is how the simplest artificial neuron learns — not by thinking, but only by moving a single boundary. For XOR it never works: no straight line can separate those points.

Classification Plane

Classification Plane: 1/4 Correctly Classified, Accuracy 25%. w₁=0.50, w₂=0.50, The Neuron bias=0.00.

○ Class 0 (○)● Class 1 (●) Decision Boundary

The Neuron

x₁x₂bw₁=0.50w₂=0.50Σσ0
  • w₁, w₂
  • b
  • Σ
  • σ
🧠

Look at the neuron on the right: inputs flow in, get weighted and summed up.

The perceptron is the simplest neural network - a single artificial neuron. It takes inputs, weighs them, sums them up, and then decides: Yes (1) or No (0).

The Weights (w₁, w₂)

Weights determine how important each input is. Positive weights strengthen, negative weights weaken the influence. The combination of weights determines the direction of the decision line.

The Bias (b)

The bias shifts the decision line. A positive bias makes it easier to output 1; a negative one makes it harder. It's like a 'default setting' for the neuron.

The Activation Function (σ)

The activation function makes the final decision: If the weighted sum is greater than 0, the neuron outputs 1 (fires). If it's less than or equal to 0, it outputs 0 (doesn't fire).

Perceptron Explained

TheoryHistoryPseudo-CodeStep by StepFlow Diagram

The first artificial neuron

The perceptron is the ancestor of all neural networks. It is a mathematical model of a single neuron, invented in 1957 by Frank Rosenblatt. Despite its simplicity, it contains all fundamental concepts of machine learning: inputs, weights, summation, and activation.

Mathematical Foundation

The perceptron calculates a weighted sum of its inputs: z = w₁x₁ + w₂x₂ + ... + wₙxₙ + b. Here, x are the input values, w are the weights (which determine how important each input is), and b is the bias (a shift constant). The output is 1 if z > 0, otherwise 0.

What can the perceptron do?

  • Linear Classification: Separation of two classes by a straight line (or hyperplane)
  • Logical Functions: AND and OR can be perfectly represented
  • Simple Pattern Recognition: Can distinguish between two simple patterns

The Fundamental Limitation

The perceptron can only solve linearly separable problems. The XOR problem (Exclusive Or) is the classic counterexample: The points lie diagonally and cannot be separated by a single straight line. This realization led to the AI Winter in 1969.

Learning Rule

The perceptron learns through the perceptron learning algorithm: For each misclassified point, the weights are adjusted: w_new = w_old + η × (y - ŷ) × x, where η is the learning rate, y is the expected and ŷ is the predicted result.

Try it yourself! Move the decision boundary in the demo and observe how the classification changes.

Test Your Knowledge

Question 1 / 5
Not completed

What does a perceptron do?

Select one answer
Answer Key: 1) C · 2) B · 3) D · 4) A · 5) C