grid_search
- sherpa.optmethods.optfcts.grid_search(fcn, x0, xmin, xmax, num=16, sequence=None, numcores=1, maxfev=None, ftol=np.float64(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
sequenceisNone, sonpar^numfits will be evaluated, wherenparis the number of free parameters. The grid spacing is uniform.sequence (sequence of numbers or
None) – The list through which to evaluate. Leave asNoneto use a uniform grid spacing as determined by thenumattribute.numcores (int or
None) – The number of CPU cores to use. The default is1and a value ofNonewill use all the cores on the machine.maxfev (int or
None) – Themaxfevattribute ifmethodis notNone.ftol (number) – The
ftolattribute ifmethodis notNone.method (str or
None) – The optimization method to use to refine the best-fit location found using the grid search. IfNonethen 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: