List of internal and external optimizers

Internal optimizers

Base class for internal optimizers

class PyAstronomy.funcFit.IFitterBase

Base class for internal fitter.

Methods

__call__(*args, **kwargs)

Wrapper around the actual fit method.

fit(minifunc, x0)

Carry out the minimization.

getObjFuncValue()

Access value of objective function.

fit(minifunc, x0)

Carry out the minimization.

Parameters
minifunccallable

Objective function.

x0list

Starting values

Returns
Resultlist or tuple

First item is a list of the best-fit values and second item is the value of the objective function.

getObjFuncValue()

Access value of objective function.

Returns
valuefloat

Value of objective function.

ScipyFMIN

class PyAstronomy.funcFit.ScipyFMIN(*args, **kwargs)

Wrapper around scipy.optimize.fmin.

Methods

__call__(*args, **kwargs)

Wrapper around the actual fit method.

fit(miniFunc, x0, *fminpars, **fminargs)

Wrapper around scipy.optimize.fmin.

getObjFuncValue()

Access value of objective function.

fit(miniFunc, x0, *fminpars, **fminargs)

Wrapper around scipy.optimize.fmin.

FuFNM

FuFNM is based on the Nelder-Mead-Simplex implemenetation of funcFit (see NelderMead()).

class PyAstronomy.funcFit.FuFNM(*args, **kwargs)

Downhill-Simplex algorithm for minimization.

This implementation is based on the publication: Nelder and Mead, The Computer Journal 7, 308-313, 1965 (NM 1965)

Halting criterion

The default stop criterion is the one used by NM 1965. In particular, the value

\[\sqrt{\sum (\bar{y}-y_i) / n}\]

is calculated. If it falls below the limit defined by the attribute nmCritLim, the iteration stops.

Parameters
abgtuple of three floats, optional

Values for alpha, beta, and gamma.

iswfloat, optional

Initial step width for simplex.

critlimfloat, optional

Critical limit for stopping criterion.

Attributes
alpha, beta, gammafloat

The reflection-, expansion-, and contraction-coefficients. The default values (after NM 1965) are 1.0, 0.5, and 2.0. These coefficients control the modification of the simplex.

initialStepWidthFacfloat

This factor determines how the initial simplex is calculated. The first simplex point is the starting value, the others are constructed by adding a fraction defined by this factor to the starting value. The default is 0.05.

nmCritLimfloat

Critical value for the NM 1965 stopping criterion. The default is 1e-8.

Methods

__call__(*args, **kwargs)

Wrapper around the actual fit method.

fit(miniFunc, x0, *fminpars, **fminargs)

Wrapper around funcFit's NelderMead implementation.

getObjFuncValue()

Access value of objective function.

fit(miniFunc, x0, *fminpars, **fminargs)

Wrapper around funcFit’s NelderMead implementation.

See the implementation of the fit method of NelderMead() for the available keyword arguments (fminargs).

External optimizers