Compute_cost keeps failing one test and can’t fathom what I’m doing wrong.

Backward_propagation() is also failing a test but I think it is the same issue.

Compute_cost keeps failing one test and can’t fathom what I’m doing wrong.

Backward_propagation() is also failing a test but I think it is the same issue.

1 Like

I have the same issue… I also do not know how to solve this

Hi @stevenkolawole , there is nothing wrong with what your are doing, but if you look carefully compare the formula and text under 4.4 -Compute the costs, and the example given at the start of the exercise 5, you see that you have implemented only part of the function. There is another part missing that you need to add. This applies to both the logprobs as well as the cost.

See if you can figure it out, and let us know. Can I ask you to delete the snippet of the code later on?

regards Stephanus

1 Like

Hi @LARSVDH Have a good look at the formula at the start of the section 4.4 and the example given under exercise 5.

regards Stephanus

1 Like

Hi @sjifscher,

It worked. Thank you.

But I feel the confusion was caused by the cross-entropy loss example given under 5 when what we’re actually calculating is the log loss. Maybe that could be amended later.

Here is the other error I’m having in section 4.5.

dZ1 seems to be the line from where the error is coming, but I can’t fathom out the exact error.

Hi @stevenkolawole , you are almost there. Have a good look at the Tips underneath figure 1 on the computation of dZ1,

regards Stephanus

1 Like

Good to hear you managed to solve it!