grid_search
- sherpa.optmethods.optfcts.grid_search(fcn, x0, xmin, xmax, num=16, sequence=None, numcores=1, maxfev=None, ftol=1.1920928955078125e-07, method=None, verbose=0)[source] [edit on github]
Grid Search optimization method.
This method evaluates the fit statistic for each point in the parameter space grid; the best match is the grid point with the lowest value of the fit statistic. It is intended for use with template models as it is very inefficient for general models.
- Parameters:
fcn (function reference) – Returns the current statistic and per-bin statistic value when given the model parameters.
x0 (sequence of number) – The starting point, minimum, and maximum values for each parameter.
xmin (sequence of number) – The starting point, minimum, and maximum values for each parameter.
xmax (sequence of number) – The starting point, minimum, and maximum values for each parameter.
num (int) – The size of the grid for each parameter when
sequence
isNone
, sonpar^num
fits will be evaluated, wherenpar
is the number of free parameters. The grid spacing is uniform.sequence (sequence of numbers or
None
) – The list through which to evaluate. Leave asNone
to use a uniform grid spacing as determined by thenum
attribute.numcores (int or
None
) – The number of CPU cores to use. The default is1
and a value ofNone
will use all the cores on the machine.maxfev (int or
None
) – Themaxfev
attribute ifmethod
is notNone
.ftol (number) – The
ftol
attribute ifmethod
is notNone
.method (str or
None
) – The optimization method to use to refine the best-fit location found using the grid search. IfNone
then this step is not run.verbose (int) – The amount of information to print during the fit. The default is
0
, which means no output.
- Returns:
retval – A boolean indicating whether the optimization succeeded, the best-fit parameter values, the best-fit statistic value, a string message indicating the status, and a dictionary returning information from the optimizer.
- Return type: