I am using scipy minimize function, mostly the BFGS method. I need to find how many function evaluation were executed between 2 following iterations. This function evaluation usually aim to calculate numerical derivatives.
If it is possible to find how many gradient evaluation were calculated between iterations, that would be even better.
Example of code:
def callback_params(theta):
global params
params = np.vstack((params, theta))
def rosen(X):
return (1.0 - X[0])**2 + 100.0 * (X[1] - X[0]**2)**2 + \
(1.0 - X[1])**2 + 100.0 * (X[2] - X[1]**2)**2
init = np.random.rand(3)
params = np.empty([0, 3])
res = minimize(rosen,init, method='BFGS',options = {'disp': True}, callback=callback_params)
How can I know the number of function evaluation between 2 rows in params?