Programming Assignment

Hi @Ayesha_Amjad1,

Welcome to our community!

The error means that your code wasn’t implemented correctly, because in one of the test cases, when it expected for an answer of 2.15510667 , your solution returned 0.15761825329865956 which had underestimated it.

Note that it is part of your assignment to debug any problem in your solution, however, we can provide some suggestions:

  1. I have looked at the hint provided right beneath the exercise’s code cell and it has provided the skeleton of how your solution should look like. Please strictly follow it along with all the indentations (the spaces at the beginning of a code line). Then based on that skeleton, fill in the missing code. Note that indentation is a major source of error. The least is that you need to strictly follow the skeleton provided in the hint. Here is a 5-min post on what indentation is and how to indent.

  2. If you need more clues, print the inputs and all intermediate outputs. For example, if you print the inputs, the test case in question has only 5 samples and 2 features per sample, which is small enough for you to verify any intermediate output by hand. Then, according to the skeleton provided by the hint, there are 5 intermediate outputs (z_wb_ij, z_wb, f_wb, loss, loss_sum, total_cost) that were updated throughout the solution. You only need to print each of them each time it gets updated, so that you can inspect whether the updated values are as expected. Once you spot any unexpected update, you find the code line that needs correction. After you have passed all the public tests for this exercise, remember to remove all the print code as they will interfere with the autograder and fail your submission.

Good luck,
Raymond