Overview¶
The main class that is responsible for handling the data statistics, as
well as the covariance matrix used during parameter estimation, is
the pyRSD.rsdfit.FittingDriver
class. This class combines data and
theory to run a Bayesian likelihood analysis.
Information about the parameters that are needed to initialize
the FittingDriver
class can be found by using
the FittingDriver.help()
function,
In [1]: from pyRSD.rsdfit import FittingDriver
# print out the help message for the parameters needed
In [2]: FittingDriver.help()
Initialization Parameters for FittingDriver
--------------------------------------------------
burnin :
An integer specifying the number of MCMC steps to consider as part
of the "burn-in" period when saving the results
This doesn't affect the parameter estimation at all; it simply
changes what best-fit parameters are printed to the screen when
the fitting is over. All iterations are saved to file regardless of
the value of this parameter.
Default: 0
epsilon :
The Gelman-Rubin convergence criterion
Default: 0.02
init_from :
How to initialize the optimization; can be 'nlopt', 'fiducial',
'prior', or 'result'; default is None
Default: fiducial
init_scatter :
The percentage of additional scatter to add to the initial fitting
parameters; default is 0
Default: 0
lbfgs_epsilon :
The step-size for derivatives in LBFGS; default is 1e-4
A dictionary can supplied where keys specify the value to use
for specific free parameters
Default: 0.0001
lbfgs_numerical :
If `True`, evaluate gradients of P(k,mu) numerically using finite difference
Default: False
lbfgs_numerical_from_lnlike :
If `True`, evaluate the gradient by taking the numerical derivative
of :func:`minus_lnlike`
Default: False
lbfgs_options :
Configuration options to pass to the LBFGS solver
Default: {'factr': 100000.0, 'gtol': 1e-05}
lbfgs_use_priors :
Whether to use priors when solving with the LBFGS algorithm; default
is ``True``
Default: True
start_from :
The name of a result file to initialize the optimization from
Default: None
test_convergence :
Whether to test for convergence of the parameter fits
For MCMC fits, the Gelman-Rubin criteria is used as specified
by the 'epsilon' parameter. For the LBFGS solver, the
convergence criteria is set by the 'lbfgs_options' attribute.
Default: False
theory_decorator :
A decorator to wrap the default theory output.
Users can use this to compute linear combinations of multipoles, for
example.
Default: {}
tracer_type :
The type of tracer, either 'galaxy' or 'quasar'
Default: galaxy
These parameters should be specified in the parameter file that is passed
to the rsdfit
executable and the names of the parameters should be
prefixed with the driver.
prefix. In our example parameter file
discussed previously, we the following parameters
#-------------------------------------------------------------------------------
# driver_params
#-------------------------------------------------------------------------------
driver.burnin = 0
driver.epsilon = 0.02
driver.init_from = 'fiducial'
driver.init_scatter = 0.0
driver.lbfgs_epsilon = {'Nsat_mult': 0.01, 'f1h_cBs': 0.01}
driver.lbfgs_options = {'ftol': 1e-10, 'xtol': 1e-10, 'gtol': 1e-05}
driver.lbfgs_use_priors = True
driver.solver_type = 'nlopt'
driver.start_from = None
driver.test_convergence = False
#-------------------------------------------------------------------------------
These parameters allow the user to specify which type of data is being
fit, either “galaxy” or “quasar” and to pass options to the solver being used,
either the emcee
MCMC solver or the NLOPT
solver. We will detail the MCMC solver (MCMC) and the
LBFGS solver (Nonlinear Optimization) in the next sections.