DLS 2 Week 3_Exercise_6_compute_cost()_ERROR

Hi, Janine.

If the “expected value” is 0.81xxx, then that is the new version of the notebook. They recently (early September 2022) changed the definition of the compute_cost function in this assignment to be the sum of the costs across all the samples, rather than the mean of the costs across the samples. The reason that they did that is to make it consistent with how the compute_cost function worked in the minibatch logic in the Optimization Assignment in C2 W2. When we are doing Minibatch Gradient Descent, it works better to just keep the running sum of the costs across all the samples in all the minibatches and then to compute the average cost only when we finish each Epoch (a full pass through all the minibatches). The reason is that all the minibatches will not be the same size if the batch size does not evenly divide the total training set size, right? We saw an example of that in the minibatch assignment that I mentioned above. So the average of the averages would not work in that case. To get the detailed picture, please have a look at how that logic worked in the previous exercise.

Please check that you used reduce_sum and not reduce_mean in your compute_cost logic.

Also just as a general note: anytime you want to get a clean copy of the latest version of any assignment, there is a topic about how to do that on the DLS FAQ Thread (the very first topic there).