even though my code and expected outputs are correct iam getting an assertion error can anyone help me with this
{moderator edit: code removed}
even though my code and expected outputs are correct iam getting an assertion error can anyone help me with this
{moderator edit: code removed}
Please do not post your code on the forum. That is not allowed by the community standards.
I have removed the code from your post.
You have no proof your code is correct. This is shown because your code fails one of the tests in the compute_gradient_test() function.
If your code was correct, it would pass all the tests.
Look at your code again closely.
Hint: How many times are you adding ‘b’ to the z_wb value?
Getting close to the expected result for the initial test does not prove your code is perfect.
Note also, your code does not give the correct results for the the first compute_gradient() test, where w and b are both set to zeros. Your ‘w’ value is wrong.
Tip for fixing that: Check that you have the parenthesis correct when you compute dj_dw_ij.
And the error with the number of times you’re adding ‘b’ only impacts the tests where ‘b’ is non-zero.
Fixing these two issues should clean up the problem.
{moderator edit: code removed}
The code works correctly for the zero case, but does not work for non-zero code. Not sure why?
Please do not post your code on the forum. That’s not allowed by the course community standard.
You can post your error messages and any asserts, but not the code itself.
I have edited your post to remove the code.
If you are going to accumulate z_wb for each example, you need to initialize it to zero every time you increment the ‘i’ index and start computing the next example.
The all-zeros test doesn’t catch this error, because when w and b are zeros, the z_wb value is always going to be zero, and it never has anything to accumulate.
Thank you @TMosh, apologies for my screenshot with code, the solution helped resolved the issue I was facing. Thank you again.