AI / ML Theory
Chapter 1 · 26 min

1.5 — The perceptron algorithm and Novikoff's convergence theorem

Goal: State the perceptron learning rule and prove it converges in at most R²/γ² updates on a linearly separable dataset.

1. Why this session exists

The perceptron (Rosenblatt, 1958)[1] is the first training algorithm for a linear classifier, predating gradient descent on smooth losses. It is also the first algorithm in this course we can prove a clean convergence theorem about. The proof — due to Novikoff (1962)[2] — is a one-page induction using the geometric quantities from 1.4. After we have it, every later statement about neural-network training will be measured against this baseline.


2. The model

Use ±1\pm 1 labels: yi∈{−1,+1}y_i \in \{-1, +1\}. The classifier:

y^(x)=sign⁡(w⊤x+b).\hat y(x) = \operatorname{sign}(w^\top x + b).

To simplify notation, absorb the bias into the weight vector by augmenting every input with a constant feature:

x~=(x1)∈Rn+1,w~=(wb)∈Rn+1.\tilde x = \begin{pmatrix} x \\ 1 \end{pmatrix} \in \mathbb{R}^{n+1}, \qquad \tilde w = \begin{pmatrix} w \\ b \end{pmatrix} \in \mathbb{R}^{n+1}.

Then w⊤x+b=w~⊤x~w^\top x + b = \tilde w^\top \tilde x, and everything works in terms of w~∈Rn+1\tilde w \in \mathbb{R}^{n+1}. For the rest of this session we drop the tildes and pretend the bias is just another weight on a constant-1 feature.


3. The learning rule

Initialise w0=0w_0 = 0. Iterate over the data (round-robin or arbitrary order). At each step, given the current wkw_k and a chosen example (xi,yi)(x_i, y_i):

  • Correct case (yi wk⊤xi>0y_i\, w_k^\top x_i > 0): leave ww unchanged.
  • Mistake case (yi wk⊤xi≤0y_i\, w_k^\top x_i \le 0): update
 wk+1  =  wk+yi xi. \boxed{\ w_{k+1} \;=\; w_k + y_i\, x_i.\ }

The update pushes ww in the direction that improves the score yi wk⊤xiy_i\, w_k^\top x_i for the example that was just misclassified:

yi wk+1⊤xi=yi wk⊤xi+yi2 ∥xi∥2=yi wk⊤xi+∥xi∥2.y_i\, w_{k+1}^\top x_i = y_i\, w_k^\top x_i + y_i^2\, \lVert x_i \rVert^2 = y_i\, w_k^\top x_i + \lVert x_i \rVert^2.

Each mistake increases that example's score by ∥xi∥2>0\lVert x_i \rVert^2 > 0.


4. Novikoff's theorem

Setup. Suppose the dataset {(xi,yi)}i=1m\{(x_i, y_i)\}_{i=1}^m is linearly separable with geometric margin γ>0\gamma > 0, i.e. there exists a unit vector u∈Rn+1u \in \mathbb{R}^{n+1} (with ∥u∥=1\lVert u \rVert = 1) such that

yi u⊤xi  ≥  γfor all i.y_i\, u^\top x_i \;\ge\; \gamma \quad \text{for all } i.

Suppose all inputs are bounded in norm: ∥xi∥≤R\lVert x_i \rVert \le R for all ii.

Claim. Starting from w0=0w_0 = 0 and running the perceptron rule of §3, the total number of mistakes (and hence updates) is at most

 M  ≤  R2γ2. \boxed{\ M \;\le\; \frac{R^2}{\gamma^2}. \ }

In particular, the algorithm terminates in finitely many steps.

Proof. Let wkw_k be the weight vector after the kk-th mistake. We track two quantities.

Bound 1 — alignment with uu grows linearly. Take the inner product of the update wk+1=wk+yixiw_{k+1} = w_k + y_i x_i with uu:

u⊤wk+1=u⊤wk+yi u⊤xi≥u⊤wk+γ.u^\top w_{k+1} = u^\top w_k + y_i\, u^\top x_i \ge u^\top w_k + \gamma.

By induction, since u⊤w0=0u^\top w_0 = 0,

u⊤wk  ≥  k γ.u^\top w_k \;\ge\; k\, \gamma.

By the Cauchy–Schwarz inequality, u⊤wk≤∥u∥⋅∥wk∥=∥wk∥u^\top w_k \le \lVert u \rVert \cdot \lVert w_k \rVert = \lVert w_k \rVert, hence

∥wk∥  ≥  k γ.(⋆)\lVert w_k \rVert \;\ge\; k\, \gamma. \qquad (\star)

Bound 2 — squared norm grows at most linearly. Expand the squared norm of wk+1w_{k+1}:

∥wk+1∥2=∥wk∥2+2 yi wk⊤xi+∥xi∥2.\lVert w_{k+1} \rVert^2 = \lVert w_k \rVert^2 + 2\, y_i\, w_k^\top x_i + \lVert x_i \rVert^2.

Because the update was applied only when yi wk⊤xi≤0y_i\, w_k^\top x_i \le 0, the cross term is ≤0\le 0. And ∥xi∥2≤R2\lVert x_i \rVert^2 \le R^2. So

∥wk+1∥2  ≤  ∥wk∥2+R2.\lVert w_{k+1} \rVert^2 \;\le\; \lVert w_k \rVert^2 + R^2.

By induction from ∥w0∥2=0\lVert w_0 \rVert^2 = 0,

∥wk∥2  ≤  k R2.(⋆⋆)\lVert w_k \rVert^2 \;\le\; k\, R^2. \qquad (\star\star)

Combining. From (⋆)(\star), ∥wk∥2≥k2γ2\lVert w_k \rVert^2 \ge k^2 \gamma^2. From (⋆⋆)(\star\star), ∥wk∥2≤kR2\lVert w_k \rVert^2 \le k R^2. So

k2γ2  ≤  kR2  ⟹  k  ≤  R2γ2.k^2 \gamma^2 \;\le\; k R^2 \implies k \;\le\; \frac{R^2}{\gamma^2}.

This holds at every kk at which a mistake occurs. Hence the total number of mistakes is M≤R2/γ2M \le R^2 / \gamma^2. ■\blacksquare


5. What the bound says and does not say

  • Margin matters. Halving the margin quadruples the worst-case update count. Wider margins → faster convergence.
  • Scale matters only through RR. Rescaling all xix_i by the same constant cc scales both RR and γ\gamma by cc, leaving R2/γ2R^2 / \gamma^2 unchanged.
  • No assumption on data order. Adversarial orderings can hit the bound; favourable orderings finish faster. The total mistake count is invariant under reorderings.
  • Non-separable data. The theorem fails — there is no uu with the required property. The perceptron will oscillate forever. The pocket variant (keep the best ww seen so far) is the classical workaround; in modern practice we use logistic regression with regularisation, which always has a unique solution.

6. A worked toy example

Two points in R2\mathbb{R}^2: x+=(1,0)x_+ = (1, 0) with y=+1y = +1, x−=(−1,0)x_- = (-1, 0) with y=−1y = -1. Augment with the constant feature: x~+=(1,0,1)\tilde x_+ = (1, 0, 1), x~−=(−1,0,1)\tilde x_- = (-1, 0, 1).

R=2R = \sqrt 2 and u=(1,0,0)u = (1, 0, 0) achieves yi u⊤x~i=1y_i\, u^\top \tilde x_i = 1 for both points, so γ=1\gamma = 1. Novikoff bound: M≤2/1=2M \le 2 / 1 = 2.

Start w0=0w_0 = 0. Both examples score 00, so both trigger mistakes. Suppose we hit x~+\tilde x_+ first:

w1=0+(+1) (1,0,1)=(1,0,1).w_1 = 0 + (+1)\,(1, 0, 1) = (1, 0, 1).

Now check x~−\tilde x_-: the signed score is y w1⊤x~−=(−1)(−1+0+1)=0y\, w_1^\top \tilde x_- = (-1)(-1 + 0 + 1) = 0, still a mistake. Update:

w2=w1+(−1) (−1,0,1)=(2,0,0).w_2 = w_1 + (-1)\,(-1, 0, 1) = (2, 0, 0).

Both examples now score +2>0+2 > 0. Done. Two mistakes total, exactly hitting the Novikoff bound.


7. Takeaways

  • Perceptron rule: wk+1=wk+yixiw_{k+1} = w_k + y_i x_i on mistakes, no-op on correct examples.
  • Novikoff: M≤R2/γ2M \le R^2 / \gamma^2 updates on a linearly separable dataset.
  • Proof: two inductive inequalities and one Cauchy–Schwarz application.
  • Margin is the central quantity; the same theme recurs in SVMs and in PAC-style generalisation bounds.

Self-test

(a) Run the perceptron on the dataset x1=(0,1)x_1 = (0, 1), x2=(1,0)x_2 = (1, 0), x3=(−1,0)x_3 = (-1, 0) with labels (+1,+1,−1)(+1, +1, -1) (augment with a bias feature). Show every update, and verify the bound M≤R2/γ2M \le R^2 / \gamma^2 is respected.

(b) Convince yourself the choice w0=0w_0 = 0 is not essential: redo the inductive step with w0≠0w_0 \ne 0 and adjust the bound.

(c) What goes wrong on a non-separable dataset? Run the perceptron on x1=(1,1)x_1 = (1, 1), x2=(−1,−1)x_2 = (-1, -1) labelled +1+1, plus x3=(1,−1)x_3 = (1, -1), x4=(−1,1)x_4 = (-1, 1) labelled −1-1 (this is XOR). Describe the long-run behaviour.

(d) Modify the rule to weight updates by a learning rate α>0\alpha > 0: wk+1=wk+α yi xiw_{k+1} = w_k + \alpha\, y_i\, x_i. Does Novikoff's bound still hold? Does α\alpha appear in the final answer?


References

  1. [1]

    Rosenblatt, F. (1958). "The perceptron: A probabilistic model for information storage and organization in the brain". Psychological Review, 65, 386–408. — Perceptron model (1.5).

    ↩
  2. [2]

    Novikoff, A. B. J. (1962). "On convergence proofs on perceptrons". Symposium on the Mathematical Theory of Automata, 12, 615–622. — Mistake bound for the perceptron (1.5).

    ↩