You“I’m going to teach Rosenblatt’s algorithm today. What is the best way to teach it? Remind me exactly the algorithm.”
Agent“Teach it as geometry first, proof second, failure third. The algorithm is four lines; the value is all in what students see while running it by hand. … Augment each x with a constant 1 so the bias rides along in w. Labels y ∈ {+1, −1}.”
w ← 0
repeat until no mistakes (or max epochs):
for each (x, y) in training set:
if y (w · x) ≤ 0: # mistake, including ties
w ← w + η y x # η = 1“Updates happen only on mistakes. Correct points are untouched. … If some unit w* separates the data with margin γ = mini yi(w*·xi) > 0, and ∥xi∥ ≤ R, the algorithm makes at most (R/γ)² mistakes, regardless of presentation order.”
“The proof is a sandwich and fits on one board:”
- Every mistake grows the projection:
w*·wk ≥ w*·wk−1 + γ, sow*·wk ≥ kγ. - Every mistake barely grows the length:
∥wk∥² = ∥wk−1∥² + 2y(wk−1·x) + ∥x∥² ≤ ∥wk−1∥² + R², because the middle term is≤ 0exactly when it was a mistake. So∥wk∥ ≤ √k·R. - Cauchy–Schwarz:
kγ ≤ w*·wk ≤ ∥wk∥ ≤ √k·R, which rearranges tok ≤ (R/γ)².
“No d, no n. Students should notice that and be bothered by it.”
Correct, complete, and delivered in one prompt — but too compact for any intuition.