Drag the background!

Step 7. Perceptron

This program implements a Perceptron finding a line to separate two groups of points.

Note the video has a screenshot of the exercise as it appears in an M.Sc. course. You do not have access to this course. See the exercise below instead.

Video

World

Perceptron
Perceptron to separate points.

Notes

  • On each run, there is a set of points that is linearly separable.
  • We achieve this by defining a random (blue) line on each run.
    Points above the line (green) are one class (output should be 1).
    Points below the line (pink) are another class (output should be -1).

  • Starts with random perceptron, i.e. random (white) line.
  • Perceptron learns by getting output wrong to change until all outputs are right.


Credits

  • Port of Perceptron from here from "The Nature of Code" (by the "Coding Train").
  • See videos parts one and two.

Exercise

Clone and Edit the World.
  1. Change the number of points.
  2. Change the line definition.
  3. Change the Learning Constant. Make it very large or very small. What happens?

  4. Q. Why does it stop before perfectly matching the line?

  5. Change the code to detect when it has reached error zero on all points and stop.
  6. Change learning rate to start high and decline.

The background is a program, showing the JavaScript graphics used on this site.
The globes light up when you log in.
 
Font:

Users retain ownership of user content.

Platforms      Stats      The name      Terms and conditions

Call for partners      Contact

Call for partners!
Ancient Brain is looking for a partner to co-write a JavaScript or Python coding book for schools, to be used worldwide. This would be a course for students in learning to code from scratch. The book and course will be integrated into the Ancient Brain site. This is an opportunity for someone looking to develop a course and textbook to partner with a site to promote it. Read more.