Hi There, I am having problems compleating Exorsise 2 of week 2 Practice Lab. I am pretty sure i am doing it right but I get very slightly wrong answers (like to the 8th decima place wrong). Then when i compute the cost and gradiant for Non-Zero ‘w’ I am about 4 off for w and exactly 0.4 off for b. This continues through the script unitl the final predictions at the end of the script are wildly different and the linear fit is not good at all. Any help or similar problems please let me know? I dont want to submit untill I pass all the tests.

Hello Harrison,

Did you try referring to the Hints given below the grader cell?

I hope you have followed the template code given and did not add any extra code line.

Please share the screenshot of the error log or the output you get with the expected output.

Do not post the grader code cell here. It is against community guidelines

Regards

DP

This means there is an error in your code when w and b are not zeros. What this means is your code isn’t handling the w and b variables correctly. It’s an easy mistake to make, becaue when w and b are both zero, most sorts of errors are invisible.

What do you think? Thanks for your help, after i didnt get the expected outcome i followed the template exactly but it still gave me the same outcome?

Thanks TMosh! but How can I fix this?

Hello Harrison,

Based on your error log,

you dj_dw and dj_db codes are incorrect. Looks like you have added extra code line.

if dj_db_i = f_wb - y[i] and dj_db += dj_db_i, then what will be dj_db += in a single code line?

if dj_dw_i = (f_wb - y[i]) * x[I] and dj_dw += dj_dw_i, then what will be dj_dw += in a single code line?

recall your dj_db and dj_dw only the way the template codes wants you to recall in a single code line and based on the above hints, it is simple that dj_db += is nothing but the value of what dj_db_i, so you need to put the same value here.

Same goes for dj_dw

Regards

DP