AssertionError: Wrong value for dj_db. Expected: 0.28936094 got: -0.07142857142857142

Hello community,

I’m working on the last assignment of the course:
→ " Programming Assignment: Week 3 practice lab: logistic regression".

Actually, I completed all the coding successfully except the “Compute Gradient” function, where I’m struggling to fix the error I’m getting when I call it in the next code cell, the error message is:
→ “AssertionError: Wrong value for dj_db. Expected: 0.28936094 got: -0.07142857142857142”

I tried to fix this issue for hours, and after having the same message over an over, I decided to use the “Click for Hints” part, because I thought/think it’s because of my code. However, the error message is exactly the same.

So, after spending more than 4 hours triying to fix this, this is my last hope, I’m FRUSTRATED because I dedicated so many hours to this course that if I don’t pass this last assignment all that time invested would be for nothing…

I hope somebody here can help me.

Thank you in advance.

I’m uploading both screenshots of Compute Gradient call and error.


week-3 Supervised ML: Regression and Classification #Compute_Gradient

@Deepti_Prasad

Hello @Txitiking

Thank you for following the community guidelines as per our discussion in DM. Hope you follow the same in future.

Now comes to your issue, Your code implementations are incorrect.

Follow the below image to write the code implementation correctly.
Also when writing f_wb codes use np.dot codes and don’t just implement sigmoid to z_wb.

def compute_gradient(X, y, w, b, *argv):

Let me know if you still have issue.

Regards
DP

1 Like