fitbenchmarking.controllers.lmfit_controller module
Implements a controller for the lmfit fitting software.
- class fitbenchmarking.controllers.lmfit_controller.LmfitController(cost_func)
Bases:
Controller
Controller for lmfit
- algorithm_check = {'MCMC': [], 'all': ['differential_evolution', 'powell', 'cobyla', 'slsqp', 'emcee', 'nelder', 'least_squares', 'trust-ncg', 'trust-exact', 'trust-krylov', 'trust-constr', 'dogleg', 'leastsq', 'newton', 'tnc', 'lbfgsb', 'bfgs', 'cg', 'ampgo', 'shgo', 'dual_annealing'], 'bfgs': ['lbfgsb', 'bfgs'], 'conjugate_gradient': ['cg', 'newton', 'powell'], 'deriv_free': ['powell', 'cobyla', 'emcee', 'nelder', 'differential_evolution'], 'gauss_newton': ['newton', 'tnc'], 'general': ['nelder', 'powell', 'cg', 'bfgs', 'newton', 'lbfgs', 'tnc', 'slsqp', 'differential_evolution', 'shgo', 'dual_annealing'], 'global_optimization': ['differential_evolution', 'ampgo', 'shgo', 'dual_annealing'], 'levenberg-marquardt': ['leastsq'], 'ls': ['least_squares', 'leastsq'], 'simplex': ['nelder'], 'steepest_descent': [], 'trust_region': ['least_squares', 'trust-ncg', 'trust-exact', 'trust-krylov', 'trust-constr', 'dogleg']}
Within the controller class, you must initialize a dictionary,
algorithm_check
, such that the keys are given by:all
- all minimizersls
- least-squares fitting algorithmsderiv_free
- derivative free algorithms (these are algorithms that cannot use information about derivatives – e.g., theSimplex
method inMantid
)general
- minimizers which solve a generic min f(x)simplex
- derivative free simplex based algorithms e.g. Nelder-Meadtrust_region
- algorithms which emply a trust region approachlevenberg-marquardt
- minimizers that use the Levenberg-Marquardt algorithmgauss_newton
- minimizers that use the Gauss Newton algorithmbfgs
- minimizers that use the BFGS algorithmconjugate_gradient
- Conjugate Gradient algorithmssteepest_descent
- Steepest Descent algorithmsglobal_optimization
- Global Optimization algorithmsMCMC
- Markov Chain Monte Carlo algorithms
The values of the dictionary are given as a list of minimizers for that specific controller that fit into each of the above categories. See for example the
GSL
controller.
- cleanup()
Convert the result to a numpy array and populate the variables results will be read from
- fit()
Run problem with lmfit
- hessian_enabled_solvers = ['newton', 'dogleg', 'trust-constr', 'trust-ncg', 'trust-krylov', 'trust-exact']
Within the controller class, you must define the list
hessian_enabled_solvers
if any of the minimizers for the specific software are able to use hessian information.hessian_enabled_solvers
: a list of minimizers in a specific
software that allow Hessian information to be passed into the fitting algorithm
- jacobian_enabled_solvers = ['cg', 'bfgs', 'newton', 'lbfgsb', 'tnc', 'slsqp', 'dogleg', 'trust-ncg', 'trust-krylov', 'trust-exact']
Within the controller class, you must define the list
jacobian_enabled_solvers
if any of the minimizers for the specific software are able to use jacobian information.jacobian_enabled_solvers
: a list of minimizers in a specific
software that allow Jacobian information to be passed into the fitting algorithm
- lmfit_jacobians(params)
lmfit jacobians
- lmfit_resdiuals(params)
lmfit resdiuals
- setup()
Setup problem ready to be run with lmfit