Hi all, I created the LM algorithm based on lmfit (Minimizer) and all works well. However, sometimes the model does not find the best fit. I have to manually change for example param d to 20 (initial value) and then it works again well.
I would like to ask you if is here is some way how the created LM algorithm can find it themselves.
For example, is it possible to add more initial values or increase somehow the number of iteration (use all values in parameters bound)?
Please let me know.
I really appreciate your help.
Sample of my code:
# set parameters incluing bounds
params = Parameters()
params.add('a', value=38, min=10.0, max=100.0)
params.add('b', value=36.6, min=0.0, max=100.0)
params.add('c', value=0, min=-100.0, max=100.0)
params.add('d', value=0.00, min=0.00, max=0.02)
params.add('f', value=1, vary=False)
params.add('g', value=2, vary=False)
# do fit, here with leastsq model
minner = Minimizer(fcn2min, params, fcn_args=(x, data), iter_cb=per_iteration)
result = minner.minimize()