The result does not give expected value.
{mentor edit: code removed}
What is wrong in the code?
Welcome to the forum!
A couple of tips first:
It would help if you give the file name of the notebook you are working on.
Hi TMosh, thanks for the reply!. I am working on “Improving Deep Neural Networks: Hyperparameter Tuning, Regularization Course”, Week1 assignment, Gradient Checking. The Value of “difference” appears to be “1” in each case. Hope this heps!
In DLS, “Convolutional NN” is Course 4.
“Improving Deep Neural Networks” is Course 2.
Gradient Checking is in Course 2, Week 1, Assignment 3.
I’ll move the thread to the correct forum area.
= = = = = =
Feedback on your situation:
Do not make any changes in the notebook outside of the areas marked START
CODE HERE.
Your code should use the forward_propagation() and backward_propagation() functions. They return the correct values. That’s why they exist in the notebook.
In computing “numerator”, you have the two variables in the wrong order.
Thank you for the feedback. Despite the modification you suggested, the answer remains unchanged. It appears that the values of theta_plus and theta_minus are still the same.
Do you have an older version of the notebook? I’m concerned about the missing function argument from the gradient_check() function, and how that happened.
I don’t have older version. my gradient_check() function looks like
def gradient_check(x, theta, epsilon=1e-7, print_msg=False). Can I revert to older version?
If your version is current, there is no reason to change versions.
I don’t know if this could be related to the bug, but notice that you do not call the forward and backward propagation functions that you just wrote. Are you sure you manually recoded them correctly? What was the point of writing them, if you don’t call them? Granted they are very simple in the 1D case, but still …
I have adjusted the code to call the forward and backward functions as per TMosh’s suggestion. However the result remains unchanged.
Do not revert to an older version, that will certainly break the grader.
This indicates maybe a problem in some other part of your code in the notebook.
Are you sure you executed the function after you changed it? Typing new code and then calling the function again runs the old code. You need to click Shift-Enter on the actual code cell. Or run all the cells again with Cell → Run All.
I will. Thank you for your all help!