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:

weighted sum=x1w1+x2w2+...+xnwn+1wbweighted\ sum = x_1w_1 + x_2w_2 + ... + x_nw_n + 1w_b

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!

Sign up to start coding

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?