Skip to content
GenAI Learn/Neural Networks From First Principles
Browsing as a guest. Sign in to save your progress and earn XP as you complete chapters.

The Perceptron: A Single Neuron

7 min read

You'll learn to

  • -Understand a perceptron as a weighted sum of inputs passed through a decision function
  • -Connect the perceptron directly back to linear/logistic regression
  • -Implement the perceptron learning rule and watch a decision boundary converge

A neural network, no matter how large, is built out of a huge number of copies of one very simple unit: the artificial neuron, originally called the perceptron. Understand this one small piece thoroughly and the rest of the module falls into place quickly.

What a Single Neuron Actually Does

A neuron takes several numeric inputs, multiplies each one by its own learned weight, adds them all up along with one extra learned number called a bias, and passes that sum through a function that produces the neuron's output. That is the entire mechanism, no more and no less. If this sounds familiar, it should. It is mathematically the same weighted-sum operation behind linear and logistic regression from the Classical ML Toolbox module.

Perceptron Output
y = sign(w · x + b) = sign(Σᵢ wᵢxᵢ + b)
w · x is the dot product from the Math module: the weighted sum of inputs. sign(z) outputs +1 if z ≥ 0 and −1 otherwise, making the perceptron a binary classifier drawing a straight-line boundary.

A neural network is, at the smallest scale, built from the same weighted-sum idea as logistic regression. The power of neural networks comes entirely from combining huge numbers of these simple units together in layers, not from any single unit being individually more sophisticated.

The Perceptron Learning Rule

The weights and bias are exactly the numbers that training adjusts. The original perceptron learning rule is refreshingly simple. For each training point the perceptron currently gets wrong, nudge the weights a little in the direction that would have made it right. Watch that process happen step by step below, starting from a deliberately bad initial guess, as the boundary rotates and shifts until every point is correctly classified.

A Perceptron Learning a Straight-Line Boundary

Each update nudges the line toward whichever point it just got wrong.

class +1 class -1 misclassified

weights (w1, w2, b)

-1.00, 0.20, 1.00

misclassified now

9 / 10

update 0 / 2
Perceptron Update Rule
w ← w + α·y·x , b ← b + α·y
Applied only when a point x with true label y is misclassified. α is the learning rate. Intuitively, this nudges the weight vector toward whichever point it just got wrong, scaled by that point's own coordinates.
The perceptron learning rule, from scratch, matching the demo above

What This One Neuron Cannot Do

The original 1958 Perceptron was exactly this single unit, and it turned out to have a hard mathematical limit. A single neuron can only separate data with a straight line, or a flat plane in higher dimensions. It cannot represent problems where the correct boundary is a curve or a more complex shape, like the classic XOR pattern, where the two classes form an X that no single straight line can split. That limitation nearly ended the field in the late 1960s, and it is exactly what the next chapter's idea, stacking neurons into layers, was invented to overcome.

Interview Signal is part of Pro

See a real weak answer next to a real strong one for this exact topic.

Quiz is part of Pro

Test what you just read with a short quiz, and bank the XP.

ScaleDojo Logo
Initializing ScaleDojo