I’ve been trying to pass one unit test, I’ve tried many implementation to calculate cost correctly however I couldn’t achieve and didn’t understand where is the error.
And because my compute_cost method isn’t working correctly, nn_model is also not working correctly.
Using np.mean is technically correct. As a matter of fact, I also used this method in my first implementation. However, in this notebook, you should sum it and divide it by m like the formula, to get the score. (a little peculiar)
If it did not still work, use np.multiply in the calculation of your logloss function.
Which parts of the exercise is your grade not complete, i.e., which parts does the grader not give you full score?
Additionally, sometimes, an incomplete grade stems from issues from previous cells.
Could you please also check your previous cells (maybe cross referencing your answers with previous notebooks like C2_W3_Lab_2_Classification_with_Perceptron.ipynb would give you a better idea)
I changed the cost function to make it the same with the exercise you mentioned (with updating variable names), restarted the kernel, run all the previous cells, but I got the same result from the unit test. However with this version of my assignment, run all the cells and submitted it again, it passed. I don’t now where was the error but I am so happy that I finally be able to finish the assignment. Thank you so much for your help!
Hi, follow the log loss equation given. You need to use np.sum first and then np.multiply (look at the log loss equation) under “cost” to get the desired number.
I hope you managed to fix this, but for others that have the same issue. I noticed your cost was 0.7054… but the expected cost was 0.6931… Check your "initialize_parameters" function and make sure you initialized your W1 and W2 by multiplying them with 0.01. Look at the instruction right about that function. This will still pass the grader, but will fail here where your cost is marginally miscalculated due to the incorrect initialization.