Any assistance is greatly appreciated.
The most likely causes of incorrect results in this assignment are:
- incorrect indentation around the for-loops (this is particularly common if you’re a new Python programmer)
- not using enough sets of parenthesis to force Python to combine the terms in the correct order.
Note that all the code for this assignment can be found in the ungraded labs earlier in Week 3.
Your values are about twice as big as the expected values. Did you perhaps forget to divide by 2 somewhere? It’s hard to pinpoint the error without seeing the code. If you send the code to me directly I can take a look.
Best,
Alex
@aachandler, I looked at the notebook earlier today.
Summary:
If you’re using for-loops over the features ‘j’, be sure that your code uses [j] when updating the dj_dw vector.
Ah yes you’re absolutely right. I couldn’t spot the error but this is exactly it. I ended up suggesting to implement a vectorized approach which is much less prone to such errors.
Thanks for letting me know!