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 is None, so npar^num fits will be evaluated, where npar is the number of free parameters. The grid spacing is uniform.
sequence (sequence of numbers or None) – The list through which to evaluate. Leave as None to use a uniform grid spacing as determined by the num attribute.
numcores (int or None) – The number of CPU cores to use. The default is 1 and a value of None will use all the cores on the machine.
maxfev (int or None) – The maxfev attribute if method is not None.
ftol (number) – The ftol attribute if method is not None.
method (str or None) – The optimization method to use to refine the best-fit location found using the grid search. If None 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
tuple