autofit.BFGS#

class autofit.BFGS(name: str | None = None, path_prefix: str | None = None, unique_tag: str | None = None, tol: float | None = None, disp: bool = False, eps: float = 1e-08, ftol: float = 2.220446049250313e-09, gtol: float = 1e-05, iprint: float = -1.0, maxcor: int = 10, maxfun: int = 15000, maxiter: int = 15000, maxls: int = 20, initializer: AbstractInitializer | None = None, iterations_per_full_update: int = None, iterations_per_quick_update: int = None, silence: bool = False, session: Session | None = None, **kwargs)[source]#

Bases: AbstractBFGS

The BFGS non-linear search, which wraps the scipy Broyden-Fletcher-Goldfarb-Shanno (BFGS) algorithm.

For a full description of the scipy BFGS method, checkout its documentation:

https://docs.scipy.org/doc/scipy/reference/optimize.minimize-bfgs.html#optimize-minimize-bfgs

Abstract wrapper for the BFGS and L-BFGS scipy non-linear searches.

Parameters:
  • tol – Tolerance for termination.

  • disp – Set to True to print convergence messages.

  • maxiter – Maximum number of iterations.

  • maxfun – Maximum number of function evaluations.

Methods

apply_test_mode

Override in subclasses to reduce sampler iterations for test mode.

check_model

copy_with_paths

exact_fit

fit

Fit a model, M with some function f that takes instances of the class represented by model M and gives a score for their fitness.

make_pool

Make the pool instance used to parallelize a NonLinearSearch alongside a set of unique ids for every process in the pool.

make_sneakier_pool

make_sneaky_pool

Create a pool for multiprocessing that uses slight-of-hand to avoid copying the fitness function between processes multiple times.

optimise

Perform optimisation for expectation propagation.

output_search_internal

perform_update

Perform an update of the non-linear search's model-fitting results.

perform_visualization

Perform visualization of the non-linear search's model-fitting results.

plot_results

plot_start_point

Visualize the starting point of the non-linear search, using an instance of the model at the starting point of the maximum likelihood estimator.

post_fit_output

Cleans up the output folderds after a completed non-linear search.

pre_fit_output

Outputs attributes of fit before the non-linear search begins.

result_via_completed_fit

Returns the result of the non-linear search of a completed model-fit.

samples_from

Loads the samples of a non-linear search from its output files.

samples_via_internal_from

Returns a Samples object from the LBFGS internal results.

start_resume_fit

Attributes

logger

Log 'msg % args' with severity 'DEBUG'.

method

name

options

paths

should_plot_start_point

timer

Returns the timer of the search, which is used to output informaiton such as how long the search took and how much parallelization sped up the search time.