Hi @Retainer_No.501,
The function forward_propagation_n
returns a tuple (cost, cache)
.
You want to assign to J_plus[i] only the first part of that tuple, check the comments just before the ### BEGIN SOLUTION
line.
Oh, I see, the other thing is that you are not sending a vector to vector_to_dictionary
, you are just sending the ith value.
It solves the problem, but I am more confused.
forward_propagation_n(X, Y, vector_to_dictionary(theta_plus))[0]
does not depend on i at all, so how can it represent J_plus[i]?
Thanks.
It depends on i
in the sense that you are passing the complete theta_plus vector as a copy of the original parameter values with just the ith
element modified by epsilon
in the previous line of code.
So, on each iteration you are computing the gradient approximation just for the ith
parameter.
Hope that helps.