Hello @zbukhari,
The error says that your function cannot compute the result correctly, and that’s because the function isn’t implemented correctly.
Since debugging your code is part of your assignment, I can suggest you 2 methods for debugging, and I hope they will be helpful for the rest of assignments in this specialization. Both methods require your understanding of the exercise.
Also, sharing assignment code isn’t allowed, please remove it and only share the screenshot with the error message.
Method 1: Read the code
-
These are what we want to implement:
-
If we look at the first equation, it has 3 parts:
- \frac{\partial J(w,b)}{\partial b}^{(i)}
- \sum\limits_{i = 0}^{m-1}
- \frac{1}{m}
-
The idea is we calculate (2.1) for each sample, then sum over all samples (2.2), and then divide the resulting sum by m once (2.3)
-
Following this idea, you read your code again to see if your code is doing exactly that.
Method 2: Examine the progress of your code
-
Add printing lines in between your codes to print all intermediate variables you have assigned values to, for example,
Source: General code debugging tips -
Run your function with some simple inputs. For detailed instructions, please check this post out.
-
You check if the printed outputs are up to your expectation, if one number is unexpected, then there is a problem.
Cheers,
Raymond