Perceptron Exercise
Click to run World:
Perceptron at
Ancient Brain.
- Clone and edit the World.
- Change the line definition.
- Turn drawing the blue line off. It will look smarter!
console.log
- See what is happening using console.log
- Find the function where weights are changed and console.log what is happening.
- Find where that function is called and console.log if weights were changed or not.
- Run it and note that eventually it classifies all the points and stops changing.
- Reduce the number of points and you can see it stop quickly.
- Q. Why does it stop changing even though it did not perfectly match the line?
Other
- Q. Where is threshold defined?
Note "new Perceptron" and number of weights.
- Slow it down with frameRate
- Change LearningConstant.
Make it very large or very small.
- Large LearningConstant seems bad. It will overshoot.
But eventually, if we happen to land on the line, we will stop.
So it may not make much difference, in this problem anyway.
- Change LearningConstant to a negative value and see what happens.
- Change the code to detect when it has run through all points once with no error, and then it can stop entirely.
- Another JS demo of perceptron on codepen