You have understood that the perceptron can be trained to produce correct outputs by tweaking the regular weights.
However, there are times when a minor adjustment is needed for the perceptron to be more accurate. This supporting role is played by the bias weight. It takes a default input value of 1 and some random weight value.
So now the weighted sum equation should look like:
How does this change the code so far? You only have to consider two small changes:
- Add a 1 to the set of inputs (now there are 3 inputs instead of 2)
- Add a bias weight to the list of weights (now there are 3 weights instead of 2)
We’ll automatically make these replacements in the code so you should be good to go!