Let's Train A Perceptron!
Artificial Intelligence researchers have been trying to replicate how the human brain functions. Today, we're going to train a simple perceptron (an artificial neuron). It will learn how to properly guess on which side of the straight line circles are.
We use a set of known value pairs to train the perceptron (supervised learning).
Hit the "Train!" button below to watch the perceptron learning. When it's guessing wrong, circles are colored in red and red spikes are displayed. The magenta line is what the perceptron thinks the solution is. The black line is the solution it must figure out! You'll see the magenta line converging to the solution.
Most of the times, it learns extremely quickly. Some other times, it would require more than 1000 iterations to find the solution. Once the training is finished, feel free to hit "Train!" again to watch different learning scenarios.
I used p5.js to code this perceptron and to create the animation below. Get the entire code on my Github page.
Did you enjoy this article? Send a tip!
Bitcoin address: bc1q2wyvxgelyhvrunyrlzdennt4fnl5z2cu5vyny2
Ethereum address: 0x23568b37327dE6Be3f2A993B49fA6afD82f38f14