Week 3 Practice Lab Logistic Regression

Hi I am getting this error when running a code block in the practice lab. The Code block did not have any manual code blocks that needed to be added by the learner so I am a bit confused as to why it is giving an error. The code blocks before this block all passed the tests or the out put values matched the expected values. Any help would be appreciated.

Hi @Richardt_Gerhardus_N

this error because function compute_gradient as you may didn’t use the parameter send in the function or make sure you implement it in a good way

please feel free to ask any questions,
Thanks,
Abdelrahman

The error says that your compute_gradient() function does not return the correct value for dj_db.

Why would that be though, that block computes and displays cost and gradient with non-zero w and no code input is required so it must be taking inputs from the previous blocks. dj-db was calculated in the previous block where I got no errors and the output matched the expected values, so why is the next block failing?

Hi @Richardt_Gerhardus_N

You did(initialize) w = np.zeros(n) , b = 0 in function compute_gradient . and that isn’t correct as the are the parameter send to function compute_gradient to compute dj_db, dj_dw to doing gradient descent so make sure you didn’t change any values send to you as a parameter of function

there are difference between(dj_dw and w also dj_db and b) every variable has his own job

please feel free to ask any questions,
Thanks,
Abdelrahman

Hi @Richardt_Gerhardus_N - I think there could be in an issue in compute_gradient function implementation since you are getting a correct output when w and b = 0 and wrong output when these initial values are different. Did you check your solution against the solution hints? there could be a small error that throws off the results like indentation or something similar in the compute_gradient function.