Running the learning rule to convergence
numeric▲▲△Exact integers throughout; no rounding is needed.
STATEMENT
Run the perceptron learning rule on a separable four-point set until it stops changing. Show every weight update and every margin you tested, including the ones that produced no change.
GIVEN
Four labelled points, presented cyclically in this order:
Initialise and . The rule (Definition 7): if , set and ; otherwise do nothing.
FIND
The sequence of parameter states, the total number of updates, and the final .
STRATEGY
Test the margin of every point in order, updating immediately when one is non-positive rather than at the end of a pass. Convergence is declared when a whole pass produces no update — which is the only stopping condition the rule has.
SOLUTION
Epoch 1.
Point , . Margin . Non-positive, so this counts as a mistake even though nothing is strictly misclassified. Update:
Point , . Margin . Correct — no change.
Point , . Margin . Non-positive again. Update:
Point , . Margin . Correct.
Epoch 2. With , :
| Point | Margin | Action | |
|---|---|---|---|
| none | |||
| none | |||
| none | |||
| none |
A complete pass with no update. The rule has converged.
Reading the updates. Both updates came from a margin of exactly zero, not from a confidently wrong prediction. The rule is not waiting to be badly wrong; it moves whenever a point is not strictly on the right side. That choice is what makes the zero-initialised first step happen at all.
Answer
The final boundary is , and every point has a functional margin of at least .
Check — numeric · i-2-b02-perceptron-updates.py
margin = y * (w[0] * x[0] + w[1] * x[1] + b)
if margin <= 0:
w = [w[0] + y * x[0], w[1] + y * x[1]]; b += yPrints both updates, the four clean margins of epoch 2, and
converged after 2 updates.
Executed in CI. The digits above are the digits it printed.
Check — sanity
Every point is now correctly classified. The four margins in epoch 2 are , all strictly positive. That is the definition of having separated the data, checked directly rather than inferred from the algorithm stopping.
The bound is respected. Here (from ). The final geometric margin is . Novikoff’s bound (I.2.4) gives . Two updates is comfortably under twenty, as a valid upper bound requires.
Each update moves toward the point that caused it. After the first update , which points at — the very example that triggered it. That is what means geometrically, and it is the whole intuition of the rule.
Where this breaks
Convergence in two updates depended on the presentation order. Present the same four points as and the trace differs, though the theorem still caps the total. What no order changes is the bound: I.2.T1 holds for every order, which is what makes it a theorem about the data rather than about the shuffling.
Variation
Add a fifth point with label . The set is still separable but the margin is much smaller. Predict the effect on the mistake bound before running the rule, then run it and count.