Week2 Exercise 8 Wrong values for w

I have checked related threads but wasn’t able to find bug in my program. Most common solution i found is not passing adequate parameters to optimize function.

{moderator edit - solution code removed}

This is how my model() function look like

Hi, in the instructions above, you need to set the print cost to True for every 100 interations. Otherwise, it will keep the default feeds and won’t give the desired result. Thanks.

The problem is that you are “hard-coding” the values of number of interations, learning rate and the print flag when you call optimize from model. That means you always get the same answers regardless of what is passed in at the top level to model. Calling a function is an entirely different thing than defining a function: you can’t just “copy/paste” the definition of a function where you need to call it. That appears to be what you did and then only adjusted the X and Y values and forgot to remove the default values of the other parameters.

1 Like