C1 Week 3 Exercise 3 calculating "compute_gradient"

Hello everyone,

I have been struggling with exercise 3,so i am trying to calculate the “compute_gradient” function as following:

and it returns the following answer:

dj_db at initial w (zeros):-0.1
dj_dw at initial w (zeros):[1.450629096674169e+29, 3.2383574737544856e+29]

but expected this:

dj_db at initial w (zeros) -0.1
ddj_dw at initial w (zeros): [-12.00921658929115, -11.262842205513591]

Could anyone help me where my mistake is?

Hello @Amer_Althiab
First of all, you have posted this under General Discussion. Move it to respective course and week so that you can get help.
Second, Posting code in public is against community guidelines. Delete your code. Post only error trace.
Third, Check the indentation of the code. To know more about indentation refer Indentation in Python (IndentationError: unexpected indent)

Thanks for instructions. I moved to Course 1 under Week 3. Anyhow, I just posted the part of the code that even exists under hints in the assignment section, so there is nothing “very” important in this part of that code

Hello @Amer_Althiab,

Please check out the hints for how to calculate dj_dw.

Raymond

PS: We can’t share assignment code here so I removed it. The honor code is pretty simple and direct about this :wink: