Hi everyone,
First, thank you for the Lmfit package, I've been using it for some times, and it is really great!
About my question, I am trying to fit some very simple data to a custom function (hill), now using the dogleg method. According to the Lmfit documentation, I need to pass a jacobian function and an hessian function (see script enclosed, containing the data to fit). Yet when I try to pass the corresponding function in minimize, I got the following error:
" " "
Traceback (most recent call last):
File ~/anaconda3/envs/wBMTKAllenSDKNEST/lib/python3.11/site-packages/spyder_kernels/py3compat.py:356 in compat_exec
exec(code, globals, locals)
File ~/Downloads/Test_Dogleg.py:171
result = minimize(residual_Hill,
File ~/anaconda3/envs/wBMTKAllenSDKNEST/lib/python3.11/site-packages/lmfit/minimizer.py:2602 in minimize
return fitter.minimize(method=method)
File ~/anaconda3/envs/wBMTKAllenSDKNEST/lib/python3.11/site-packages/lmfit/minimizer.py:2346 in minimize
return function(**kwargs)
File ~/anaconda3/envs/wBMTKAllenSDKNEST/lib/python3.11/site-packages/lmfit/minimizer.py:980 in scalar_minimize
ret = scipy_minimize(self.penalty, variables, **fmin_kws)
File ~/anaconda3/envs/wBMTKAllenSDKNEST/lib/python3.11/site-packages/scipy/optimize/_minimize.py:729 in minimize
res = _minimize_dogleg(fun, x0, args, jac, hess,
File ~/anaconda3/envs/wBMTKAllenSDKNEST/lib/python3.11/site-packages/scipy/optimize/_trustregion_dogleg.py:33 in _minimize_dogleg
return _minimize_trust_region(fun, x0, args=args, jac=jac, hess=hess,
File ~/anaconda3/envs/wBMTKAllenSDKNEST/lib/python3.11/site-packages/scipy/optimize/_trustregion.py:175 in _minimize_trust_region
sf = _prepare_scalar_function(fun, x0, jac=jac, hess=hess, args=args)
File ~/anaconda3/envs/wBMTKAllenSDKNEST/lib/python3.11/site-packages/scipy/optimize/_optimize.py:402 in _prepare_scalar_function
sf = ScalarFunction(fun, x0, args, grad, hess,
File ~/anaconda3/envs/wBMTKAllenSDKNEST/lib/python3.11/site-packages/scipy/optimize/_differentiable_functions.py:189 in __init__
self.H = hess(np.copy(x0), *args)
TypeError: hebbian_hill() missing 1 required positional argument: 'x'
" " "
Do you have any idea how I can modify the code to make it work?
Thank you for any help you can give me!
Best,
Julien