brian-team / brian2modelfitting

Model fitting toolbox for the Brian 2 simulator
https://brian2modelfitting.readthedocs.io
Other
14 stars 6 forks source link

Remove lmfit #66

Closed mstimberg closed 2 years ago

mstimberg commented 3 years ago

Remove the use of lmfit and replace it by a direct call of scipy.optimize.least_squares. Even though lmfit used the same function internally, there is a difference that might affect results or speed of convergence: lmfit used a non-linear transformation of the variables to map [-∞, ∞] to the given range and then called least_squares without any bounds. The current approach instead uses the bounds feature of the least_squares algorithm itself. The internal algorithm is by default "Trust Region Reflective algorithm" instead of "Levenberg-Marquardt".

Needs some additional work to support other methods and other loss functions (e.g. with some robustness against outliers).

mstimberg commented 2 years ago

Other methods and loss functions can wait, will merge now.