I am getting the following errors:
Code Cell UNQ_C1: Function ‘compute_cost’ is incorrect. Check implementation.
Code Cell UNQ_C2: Function ‘compute_gradient’ is incorrect. Check implementation.
If you see many functions being marked as incorrect, try to trace back your steps & identify if there is an incorrect function that is being used in other steps.
This dependency may be the cause of the errors.
And I don’t know how to solve it. I believe are something wrong in the code but I didn’t find the error. Another point, I cannot edit the code so I don’t know how to proceed.
Based on previous related doubts I already:
Kernel → Restart and Clear Output
Cell → Run All
1 Like
Dear @sttanikawa,
Welcome to the Community!
Kindly ensure that all preceding cells have been executed.
If problem still persists, please let us know.
–
Keep Learning AI with DeepLearning.AI - Girijesh
Hello, @sttanikawa,
Thanks for letting us know that you tried to run all cells.
Let’s look at one function at a time, and to start with, we need to add some prints as shown in the following screenshots that based upon the code skeleton in the Hints beneath the exercise’s cell:
When you add them, please make sure to use the correct indentation (the number of spaces preceding each line, with 4 spaces for each level of indentation).
After that, run the code cell below the exercise’s cell which contains 1 explicit test case plus 5 public test cases.
I will share my print result for the second test case side by side with the equations that compute them:
Now, here is what you can do:
-
Note that the results can be calculated with the inputs (x, y, w, b) and the equations.
-
Compare my result with your own. You spot the difference, then you look at the code line for computing that different value.
-
After passing the first exercise (all public tests, plus the autograder if you want), do the similar inspection for exercise 2 on your own.
For exercise 2, I hope you will do it yourself following my example here for exercise 1. Since you don’t have my print result for it, you will have to verify your print result with your own calculation using the inputs and the equations. I meant to pick the second test case for the above because it is simpler than the explicit test case which uses too many decimal values in the inputs, so you might also pick a simpler test case for your own inspection for exercise 2.
Lastly, don’t forget to remove or comment out those printing lines after your inspection, because they may interfere with the autograder.
Good luck, and cheers!
Raymond
1 Like
Only the exercise cells are editable and all the others are locked. After each exercise cell, there will be a code cell that contains tests to the exercise. If the exercise has a problem, the testing code cell will fail but it does not mean that you need to modify anything in the testing code cell, but you will need to inspect your code for the exercise and make corrections in the exercise’s code cell.
Therefore, it is just normal that you can’t edit non-exercise code cell.
Raymond