Run the perceptron algorithm with learning rate 1, starting from w=(0,0) and b=0, on the points (2,1) with label +1, (1,−1) with +1, (−1,0) with −1 and (0,2) with −1, in this order. A point counts as a mistake if y(w⊤x+b)≤0. What are the weights after each update, and when does it stop?

Supervised learning, Perceptron
Level L2 Elementary. Length Medium. Nature Mat Mathematical.

What's being asked

Whether you can run the mistake-driven rule by hand, including the bias, and recognise when a full clean pass means convergence.

Key idea

On each mistake apply w←w+yx, b←b+y. Training ends after one full pass with no mistakes.

Steps

  1. Epoch 1, point (2,1), y=+1: score 0≤0, a mistake. Update w=(2,1), b=1.
  2. Point (1,−1), y=+1: score 2−1+1=2>0. Correct, no change.
  3. Point (−1,0), y=−1: score −2+0+1=−1, times y is +1>0. Correct.
  4. Point (0,2), y=−1: score 0+2+1=3, times y is −3≤0. Mistake. Update w=(2,1)−(0,2)=(2,−1) and b=1−1=0.
  5. Epoch 2 with w=(2,−1), b=0: scores are 3,3,−2,−2 with labels +,+,−,−, so all are correct.
  6. So it stops after two updates, with w=(2,−1), b=0, and decision boundary 2x1−x2=0.

Common mistakes

How long your answer should be

Half a page, a small table of scores.

Last checked on 4 December 2026.

Read this

Previous in Supervised learning: For the four data points (1,2),(2,3),(3,5),(4,4), set up and solve the normal equations for the line y=β0+β1x. What are the residual sum of squares and the unbiased noise-variance estimate σ^2?
Next in Supervised learning: An Adaline has two weights, no bias, starting at w=(0,0), with learning rate η=0.1 and the delta rule w←w+η(t−w⊤x) x. Apply it to the sample x=(1,2) with target t=3, then to x=(2,1) with target t=1. What are the weights after each step? For what range of η is a single repeated sample x=(1,2) stable?