Wrong values from Week 3 Programming Assignment

Hi All,

Need some help with assignment. Not sure it is due to indent issue with the syntax. I tried to follow the hints but didn’t get it right.




For one error, you’re adding the bias within the for-loop over the features.
You should only add the bias once, at the end of the loop.
Or you could fix this by initializing z_wb = b, instead of 0.

Note: I won’t be able to reply further on this thread. Perhaps another mentor can assist you.


thanks. Tried to correct the syntax and run it again but it didn’t work.


Not sure what’s wrong with it.

You did not fix the main problem.
You are still adding b within the for j loop.

I tried to use the syntax from the optional lab instead and it worked! thanks!

1 Like

Hello @Poh_Li_Jun

As @TMosh has pointed out, take a look at the indentation of z_wb += b

The way it is positioned inside the for loop, b will get added n times

For example: you will be getting -
w1x1 + w2x2 + w3x3 + b + b + b