So far so good! The perceptron works as expected, but everything seems to be taking place behind the scenes. What if we could visualize the perceptron’s training process to gain a better understanding of what’s going on?
The weights change throughout the training process so if only we could meaningfully visualize those weights…
Turns out we can! In fact, it gets better. The weights can actually be used to represent a line! This greatly simplifies our visualization.
You might know that a line can be represented using the slope-intercept form. A perceptron’s weights can be used to find the slope and intercept of the line that the perceptron represents.
slope = -self.weights[0]/self.weights[1]
intercept = -self.weights[2]/self.weights[1]
The explanation for these equations is beyond the scope of this lesson, so we’ll just use them to visualize the perceptron for now.
In the plot on your right, you should be able to see a line that represents the perceptron in its first iteration of the training process.