Hello, Could someone help me figure out what is missing in my code.
To implement the propagate function, I started with writing the activation followed by the cost, but I have one issue when writing dw. it tells me invalid syntax.
Even when I set dw = 1, it tells me the same issue: invalid syntax at dw

Thank you very much. It was a parenthesis. But for the seconnd advice, I tried to transpose A but This time the error I got is : wrong value 8.168547875217449 != 2.0424567983978403

The strategy is either to go with an element-wise multiplication or matrix operation (like dot product). Your previous implementation is mixture of two strategies.

You can see two terms that you need to tackle, i.e., y^{(i)}log(a^{(i)}) and (1-y^{(i)})log(1-a^{(i)})
If you go with a matrix operation like dot product, then, you will not need a summation.
If you go with an element-wise multiplication, then, you will need a summation.

With looking at your implementation, you use a dot product for the 2nd term. I think that’s the right way to implement (with transposing A). But you need to be consistent to both two terms above. (of course, it is possible to use a summation and dot product separately,… but, it may be a problem from a code readability.) Then, you can eliminate a summation, and get a right answer.

In any cases, you need to revisit your implementation of cost calculation.

Hi @codewith_africa. I have removed the code from your original post. @anon57530071 is indeed correct about posting code, and in fact, it is against the Specialization’s honor code. Thanks for your future compliance!