Excercise 5 - Compute Cost
logprobs = np.multiply(np.log(A2),Y)
cost = - np.sum(logprobs)
What is the use of this piece of code ? When I copy pasted this in the exercise, I got wrong answer.
cost = -np.sum(Y * np.log(A2) + (1 - Y) * np.log(1 - A2)) / m
Then I tried this , from previous assignment and it worked. It is same as written in Equation 13
𝐽=−1𝑚∑𝑖=1𝑚(𝑦(𝑖)log(𝑎[2](𝑖))+(1−𝑦(𝑖))log(1−𝑎[2](𝑖))) ...(13)
If this is correct then what will be the value of logprobs.