Skip to content

perceptron

learning

Level 2 of 3

Also called the perceptron learning rule and Rosenblatt's perceptron.

test yourself

Six questions, four to pick from and two for paper. A point such as 7 6 t is a triangle 7 across and 6 up, and s marks a square. After the points comes the step size. Each answer stays hidden until you open it.

fresh numbers: the questions a run answers, asked again on new numbers

choose one

question 1

The line starts as 1, 0 and 0. One nudge at step size 0.3 leaves it as 0.1, minus 0.6 and minus 0.3. Which point nudged it?

the answer, and why

the answer is A

All three numbers fell, the third by 0.3. The third only falls for a square, whose nudge is taken away. The first fell by 0.9, which is 0.3 times 3, and the second by 0.6, which is 0.3 times 2. So the square stands 3 right of the middle and 2 up, at 8 7.

this tests how it works, on the learn page

if you chose another

  • A triangle's nudge is added, so the third number would rise to 0.3. And a triangle at 8 7 scores 3, its own side, so it nudges nothing.
  • A triangle at 2 3 stands 3 left and 2 down, so its nudge also takes 0.9 and 0.6 off. But it adds 0.3 to the third number.
  • A square at 2 3 scores minus 3 under the starting line, its own side, so it nudges nothing.

question 2

Five points, 8 2 t, 6 7 t, 4 6 t, 1 4 s and 3 1 s, at step size 0.5. Only the triangle at 4 6 ever nudges the line, in pass 1. How many checks does the run make?

02468100246810123456
the answer, and why

the answer is D

Pass 1 nudges, so pass 2 checks every point again. It nudges nothing, and the run stops. Two passes of 5 checks make 10.

if you chose another

  • That is pass 1 alone. It nudged, so one more pass must check the new line.
  • That is all six passes. The run stops at the first pass that nudges nothing, pass 2.
  • That is how many nudges were made, not how many checks.

question 3

Three points, 5 8 t, 8 3 t and 2 6 s, at step size 0.5. How many nudges does the run make?

02468100246810123456
the answer, and why

the answer is C

The triangle at 5 8 stands no steps right of the middle, so it scores 0 under the starting line. A score of 0 is on the line, on neither side, so it nudges. The line becomes 1, 1.5 and 0.5, which has all three points on their own sides. Pass 2 nudges nothing.

if you chose another

  • Only one triangle stands right of the line. The one at 5 8 stands on it, and a point on the line counts as wrong.
  • After the first nudge the triangle at 8 3 scores 0.5 and the square at 2 6 scores minus 1, both on their own sides.
  • Only the point on the line is wrong. The other two score 3 and minus 3 at the start, each on its own side.

question 4

Which is true of a perceptron?

the answer, and why

the answer is A

A pass that nudged nothing would have found every point on its own side, so its line would split the points.

this tests best, worst and average, on the learn page

if you chose another

  • On section 1's six points, step size 0.3 stops after 2 passes and the bigger 0.5 after 3.
  • Section 3's two rows, one step apart, use all six passes at step size 0.1, yet a level line splits them.
  • In section 1 the triangle at 4 9 is right in pass 1. The square's nudge then leaves it on the line, and pass 2 finds it wrong.

pen and paper

question 5about 12 minutes

Section 1's six points, with the step size 0.1 in place of 0.5.

  1. After kk nudges, how high can the first number still stand, and how big can the sum of squares be?
  2. Work the learn page's question 4 again with those two limits. How many nudges can the run make at most?
  3. The run makes 7 nudges. Does that fit your limit?
a hint

A nudge now takes 0.1 or more off the first number, and adds 0.01 times 21 at most to the sum of squares.

a worked answer

Each nudge takes 0.1 or more off the first number, so after kk nudges it is at most 1 less 0.1 for each nudge. Each nudge adds at most 0.01 times 21, which is 0.21, to the sum of squares, so the sum is at most 1 plus 0.21 for each nudge. From 10 nudges on the first number is 0 or below, and the room works out as G=0.01k(41−k)G = 0.01k(41 - k). It is 0 at 41 nudges and below 0 from 42, so the run makes 41 nudges at most. Its 7 nudges fit, with room to spare.

At step size 0.1, take the most the sum of squares can be, less the least the first number's square can be, and call that room GG. After how many nudges does it run out?
  1. the move: the first number's square

    the line:
    from 10 nudges on, the firstnumber’s square is at least(0.1k−1)2\begin{gathered} \text{from 10 nudges on, the first} \\ \text{number's square is at least} \\ (0.1k - 1)^2 \end{gathered}

    why it is allowed: Each nudge takes 0.1 or more off the first number, which starts at 1. From 10 nudges on it is 0 or below, and stands 0.1k−10.1k - 1 or more below 0. So its square is at least (0.1k−1)2(0.1k - 1)^2.

  2. the move: the room

    the line:
    G=1+0.21k−(0.1k−1)2G = 1 + 0.21k - (0.1k - 1)^2

    why it is allowed: The sum of squares starts at 1, and each nudge adds 0.01 times 21 at most. The first number's square is never more than the sum.

  3. the move: multiply out the square

    the line:
    G=1+0.21k−(0.01k2−0.2k+1)\begin{gathered} G = 1 + 0.21k \\ - (0.01k^2 - 0.2k + 1) \end{gathered}

    why it is allowed: 0.1k−10.1k - 1 times itself is 0.01k20.01k^2, take away two lots of 0.1k0.1k, plus 1.

  4. the move: take the bracket away

    the line:
    G=0.41k−0.01k2G = 0.41k - 0.01k^2

    why it is allowed: Taking the bracket away flips each sign in it, so its 0.2k0.2k is added. The 1s cancel, and 0.21k0.21k and 0.2k0.2k make 0.41k0.41k.

  5. the move: take out what both parts share

    the line:
    G=0.01k(41−k)G = 0.01k(41 - k)

    why it is allowed: Both parts hold 0.01k0.01k, and 0.41 is 41 lots of 0.01. The room is 0 at 41 nudges and below 0 after.

try it with a small kk: at k=12k = 12, line 2 gives G=3.48G = 3.48, which you can work out by hand

this tests where the formula comes from, on the learn page

what a full answer includes
  • At most 1 less 0.1 for each nudge, and at most 1 plus 0.21 for each nudge.
  • G=0.01k(41−k)G = 0.01k(41 - k), so 41 nudges at most.
  • Yes, 7 is under 41.

question 6about 8 minutes

Eight points that no line can split.

  1. How many checks does one pass make?
  2. Count the checks of the whole run, and check them against 6n6n.
  3. How many would eight points the starting line already splits cost?
a hint

A pass that nudges nothing would have found a line that splits the points.

a worked answer

A pass checks each of the 8 points once, 8 checks. No line splits them, so every pass nudges and all six are made: 48 checks. 6n6n for 8 points is 48. Points the starting line already splits cost one pass, 8 checks, nn.

Question 5: nn points that no line can split, 3 or more. How many checks, CC, does the run make?
  1. the move: one pass

    the line:
    each pass checksn points\begin{gathered} \text{each pass checks} \\ n \text{ points} \end{gathered}

    why it is allowed: A pass works out the score of every point once, one check for each of the nn points.

  2. the move: count the passes

    the line:
    every pass nudges,so all 6 are made\begin{gathered} \text{every pass nudges,} \\ \text{so all 6 are made} \end{gathered}
    passnudges in itchecks so far
    133
    236
    339
    4312
    5215
    6218
    Section 3's three points on one row, at step size 0.5. Every pass nudges, and each adds 3 checks. The sixth brings them to 18.

    why it is allowed: A pass that nudged nothing would have found every point on its own side. Its line would split the points. No line does, so every pass nudges, and the run goes on to its sixth and last pass.

  3. the move: add them up

    the line:
    C=n+n+⋯+nC = n + n + \dots + n

    why it is allowed: CC is the checks made. By lines 1 and 2, nn for each of the 6 passes.

  4. the move: six lots

    the line:
    C=6nC = 6n

    why it is allowed: Six lots of nn. For the three points, 18.

  5. the move: a ceiling

    the line:
    C≤6nC \le 6n

    why it is allowed: By line 4, CC is 6n6n, so it is at most 6n6n.

  6. the move: read it as a bound

    the line:
    C∈O(n)C \in O(n)

    why it is allowed: By line 5, CC is at most 6 times nn.

  7. the move: a floor

    the line:
    C≥6nC \ge 6n

    why it is allowed: By line 4, CC is at least 6n6n too.

  8. the move: read it as a bound

    the line:
    C∈Ω(n)C \in \Omega(n)

    why it is allowed: By line 7, CC never drops below 6 times nn.

  9. the move: ceiling and floor together

    the line:
    C∈Θ(n)C \in \Theta(n)

    why it is allowed: Lines 6 and 8 bound CC by the same growth, nn.

try it with a small nn: at n=3n = 3, line 3 gives C=18C = 18, which you can work out by hand

this tests where the formula comes from, on the learn page

what a full answer includes
  • Eight checks.
  • Forty-eight checks, matching 6n6n.
  • Eight checks.