Perceptron
The simplest neural network: weight each input, sum the weighted inputs plus a bias, pass the sum through a sign activation function.
What it is
The source calls it “the simplest neural network possible: a computational model of a single neuron. Invented in 1957 by Frank Rosenblatt at the Cornell Aeronautical Laboratory, a perceptron consists of one or more inputs, a processor, and a single output.” It takes several numbers in and produces one number out — no layers, no hidden units, just one unit deciding.
How it works
Feeding it forward is three steps, each given directly:
- “For every input, multiply that input by its weight.”
- “Sum all the weighted inputs.”
- “Compute the output of the perceptron by passing that sum through an activation function (the sign of the sum)” — the output is the sign of that sum, a hard decision rather than a graded value.
Training reuses the same feedforward pass and then corrects it:
- Run a feedforward pass on an input whose correct answer you already know.
- “The perceptron’s error can be defined as the difference between the desired answer and its guess.”
- “Adjust all the weights according to the error.”
Repeat that over many labeled examples. What isn’t in these excerpts is the exact size of each adjustment — no formula tying the weight change to the error and no learning-rate number appears here, only the ingredients (error, weights) and the direction (move toward less error). Don’t import a specific constant from elsewhere and present it as this source’s.
Parameters & tuning
The one lever the excerpts name is the activation function itself, and it isn’t really tunable here: because it’s a sign function, every decision the perceptron makes is binary, not a confidence score. Beyond that, these excerpts stop at a single neuron’s weights and its error-driven adjustment — how fast training converges, how many examples it needs, or what a bad initialization looks like in practice isn’t covered by what’s quoted.
Where it’s been used
Nothing in these excerpts names a work built on a perceptron. The Nature of Code presents it as a teaching example, walking through the algorithm before moving on to networks built from more than one of these units.
Variants & neighbours
A feedforward neural network arranges several perceptron-like units into input, hidden, and output layers, letting it solve problems that aren’t linearly separable — something a single perceptron, with no layering to fall back on, can’t do on its own.
Neuroevolution keeps the same kind of network but discards the error-and-adjust training loop entirely, evolving a population of networks’ weights with a genetic algorithm instead of computing a per-example error signal.
Go deeper
- natureofcode.com/neural-networks — the source behind every quotation on this page.
Related, in brief
Feedforward neural network
Multiple perceptron-like neurons arranged in input, hidden and output layers with data flowing strictly forward, letting the network solve non-linearly-separable problems a single perceptron cannot.
Connected to
Contrast with: Feedforward neural network
Further reading: The Nature of Code
Used to build: Feedforward neural network · Neuroevolution