The perceptron learning procedure:

- We have a desired outcome of the perceptron for the feature vector $\mathbf{x}$ to learn: $d$
- Calculate the current perceptron outcome for the feature vector $\mathbf{x}$: $o$
- Compare the outcome with the desired outcome $d$: this is the error, thus $e = d-o$
- If the error is zero (the outcome is the same as the desired outcome), then to nothing
- Else, updates the weights of the perceptron with the scalar product of the error and the feature vector: $\mathbf{w}_{i+1} = \mathbf{w}_{i} + e\mathbf{x}$

A sample:

Click anywhere to learn the point to the perceptron visualized by the line and the vector (which represents the weight vctor of the perceptron.

If you simply click, the desired class of the point will be considered 1, if you click while holding down the shift key, the desired class will be considered 0.

By using the perceptron learning procedure, it is possible to learn a perceptron to implement an AND gate.

A sample:

x1 | x2 | desired outcome |
---|---|---|

0 | 0 | 0 |

0 | 1 | 0 |

1 | 0 | 0 |

1 | 1 | 1 |

Click anywhere on the space to learn a new point. The code iterates through the truth table of an AND gate to select points to learn. It does NOT use the point clicked !!!

As a result, when a point is choosen which is already correctly classified nothing will be happening.

As feedback to which point is choosen, the point will grow and shrink

Green means class 0 and orange means class 1. The border color signals the desired class and the fill color signals the effective class. So a dot with a green border and an orange fill means the dot should be classified to class 0 but is currently classified into class 1.

By using the perceptron learning procedure, it is possible to learn a perceptron to implement an OR gate.

A sample:

x1 | x2 | desired outcome |
---|---|---|

0 | 0 | 0 |

0 | 1 | 1 |

1 | 0 | 1 |

1 | 1 | 1 |

Click anywhere on the space to learn a new point. The code iterates through the truth table of an OR gate to select points to learn. It does NOT use the point clicked !!!

As a result, when a point is choosen which is already correctly classified nothing will be happening.

As feedback to which point is choosen, the point will grow and shrink

Green means class 0 and orange means class 1. The border color signals the desired class and the fill color signals the effective class. So a dot with a green border and an orange fill means the dot should be classified to class 0 but is currently classified into class 1.

Now try it yourself: image a line and try to learn this line to the perceptron.

Image a line and click on both sides of the imagined line. Hold down the shift key to learn points with a desired class 0. If you don't hold down the shift key, the point will have a desired class of 1.

Use the slider to change the learning rate.