The Perceptron
Source: Unit 2 §5
A perceptron takes a vector of real-valued inputs, computes a linear combination of them, and outputs +1 if the result exceeds a threshold and −1 (or 0) otherwise. It is the single artificial neuron, and everything later in the course is built from it.
- Frank Rosenblatt (1958) proposed the classical perceptron, more general than the McCulloch-Pitts neuron.
- The two key additions were numerical weights on the inputs and a learning mechanism for those weights. Inputs were no longer limited to Boolean values.
- Minsky and Papert (1969) refined and analysed it - and found the limitation in §"The XOR problem" below.
The perceptron equation
With weights , inputs , bias and :
Writing the two as vectors and collapses the sum into a dot product:
Setting and folds the threshold into the weight vector. After that there is no separate threshold to learn: the same update rule trains the bias as trains every other weight.
Geometric interpretation
We are looking for the line (in 2-D) or hyperplane (in general) that cuts the input space into two halves. Every point on that boundary satisfies , so the angle between and any such is - the weight vector is perpendicular to the decision boundary.
A perceptron represents linear Boolean functions
A single perceptron produces a linear decision surface, so it can represent AND, OR, NAND and NOR.
| Function | w₀ (bias) | w₁ | w₂ |
|---|---|---|---|
| AND | −0.8 | 0.5 | 0.5 |
| OR | −0.3 | 0.5 | 0.5 |
Worked example: learning logical OR
Write the perceptron inequality for every row of the truth table that should output 1, and the row that should output 0 for the opposite inequality.
| (x₁, x₂) | OR | Constraint |
|---|---|---|
| (0,0) | 0 | w₀ < 0 |
| (1,0) | 1 | w₁ ≥ −w₀ |
| (0,1) | 1 | w₂ ≥ −w₀ |
| (1,1) | 1 | w₁ + w₂ ≥ −w₀ |
Any weights satisfying all four inequalities implement OR - for instance , , the values in the table above.
Take = actor, = genre, = director for the question "should I watch this film?". Past data says the director matters most, so that input gets the high weight - a good director can cross the threshold on its own even when the actor and genre are unremarkable. A true movie buff has and watches anything.
The perceptron training rule
Each weight is nudged by the error :
| Symbol | Meaning |
|---|---|
xᵢ | the input |
wᵢ | the weight for xᵢ |
t | target output for the current example |
o | actual output the perceptron produced |
η | learning rate - small, for example 0.1 |
The perceptron is learning the linear surface
- Present the example and compute the actual output .
- If the example is already correct, , and no weight changes.
- If , every weight moves by , nudging the boundary toward the correct answer for this example.
- Repeat over the training set until nothing changes.
The perceptron training rule converges only if the data is linearly separable. On data that is not, it never settles - which is exactly the motivation for the delta rule on the next page.
The XOR problem: the perceptron's limitation
XOR sends (0,0) → 0, (0,1) → 1, (1,0) → 1, (1,1) → 0. Plot those four
points and the trouble is immediate.
If the data is not linearly separable, like XOR, a single perceptron is not enough. Minsky and Papert's demonstration of this is precisely why the field moved to multilayer networks.