To successfully minimise a function one should start the iteration as
close as possible to the global minimum. The search for the best
starting point is usually done by randomly sampling the parameter
space. In myFitter each Model
object can store a dictionary
of such sample points (see The Model Base Class). To build this
dictionary the Model
class provides the scan
method for
performing simple flat scans of the parameter space. However, for
particularly difficult objective functions with narrow valleys a flat
scan might not be enough to resolve all relevant features. For such
cases the Fitter
class allows you to scan the parameter space
adaptively. The adaptive scan works as follows: let
\Omega be the parameter space volume to be scanned and let
\chi^2(\xi) be the chi-square function (including constraint
penalties). Then myFitter uses VEGAS to compute the integral
\displaystyle\int_\Omega d\xi (\chi^2(\xi) + c)^-a\ ,
where a and c are positive constants to be configured by
the user. The value of this integral is completely meaningless, but
the adaptive property of the VEGAS algorithm will eventually sample
the regions with a small chi-square with a higher density. After
giving VEGAS some time to adapt one then starts filling the dictionary
of the Model
class with all the sample points tried by VEGAS.
This automatically leads to a higher resolution in the interesting
regions with small chi-square values.
The adaptive scan can be done with the methods
void Fitter::adaptive_scan(Model& model, const ObservableVector& cvals, HepSource::Int64 nfirst, HepSource::Int64 n, int niter, HepSource::Int64 nlast) void Fitter::adaptive_scan(Model& model, HepSource::Int64 nfirst, HepSource::Int64 n, int niter, HepSource::Int64 nlast)
(The 64 bit integer type HepSource::Int64
is provided by the
Dvegas package.) The adaptation phase of the VEGAS integration
consists of a first iteration with nfirst shots and then
niter iterations with n shots each. Then a final iteration
is done with nlast sample points. All the points tried in that
last iteration are written to the dictionary of the model
argument. The chi-square function in the integrand is computed with
the input_function()
member of the Fitter
object, using
the central values cvals for the observables if provided and
input_function().central_values()
otherwise.
The constant c in the integrand can be configured with the methods
double Fitter::scans_chisquare_offset() void Fitter::scans_chisquare_offset(double)
The default value is 1. The exponent a can be accessed with
double Fitter::scans_chisquare_power() void Fitter::scans_chisquare_power(double)
The default value is also 1. Finally, the number of bins used for the VEGAS adaptation can be set with
int Fitter::scans_nbins() void Fitter::scans_nbins(int)
The default setting is 50.