![]() |
MaCh3
2.2.3
Reference Guide
|
Implementation of delayed rejection for MR2T2. More...
#include <Fitters/DelayedMR2T2.h>
Public Member Functions | |
DelayedMR2T2 (manager *const fitMan) | |
Constructor. More... | |
virtual | ~DelayedMR2T2 ()=default |
Destructor. More... | |
![]() | |
MR2T2 (manager *const manager) | |
Constructor. More... | |
virtual | ~MR2T2 ()=default |
Destructor. More... | |
![]() | |
MCMCBase (manager *const fitMan) | |
Constructor. More... | |
virtual | ~MCMCBase ()=default |
Destructor. More... | |
void | RunMCMC () override |
Actual implementation of MCMC fitting algorithm. More... | |
void | StartFromPreviousFit (const std::string &FitName) override |
Allow to start from previous fit/chain. More... | |
void | setChainLength (unsigned int L) |
Set how long chain should be. More... | |
![]() | |
FitterBase (manager *const fitMan) | |
Constructor. More... | |
virtual | ~FitterBase () |
Destructor for the FitterBase class. More... | |
void | AddSampleHandler (SampleHandlerBase *sample) |
This function adds a sample PDF object to the analysis framework. The sample PDF object will be utilized in fitting procedures or likelihood scans. More... | |
void | AddSystObj (ParameterHandlerBase *cov) |
This function adds a Covariance object to the analysis framework. The Covariance object will be utilized in fitting procedures or likelihood scans. More... | |
void | DragRace (const int NLaps=100) |
Calculates the required time for each sample or covariance object in a drag race simulation. Inspired by Dan's feature. More... | |
void | RunLLHScan () |
Perform a 1D likelihood scan. More... | |
void | GetStepScaleBasedOnLLHScan () |
LLH scan is good first estimate of step scale. More... | |
void | Run2DLLHScan () |
Perform a 2D likelihood scan. More... | |
void | RunSigmaVar () |
Perform a 2D and 1D sigma var for all samples. More... | |
void | RunSigmaVarFD () |
Perform a 1D sigma var for all samples. More... | |
std::string | GetName () const |
Get name of class. More... | |
Protected Member Functions | |
double | AcceptanceProbability () override |
Step acceptance probability. More... | |
void | DoStep () override |
The MCMC step proposal. More... | |
void | StoreCurrentStep () |
Store information about the current proposed step. More... | |
void | PrepareOutput () |
override to add in rejection information to output More... | |
void | ResetSystScale () |
Reset scale after delay process. More... | |
void | ScaleSystematics (const double scale) |
Set parameter scale to be original_scale* scale. More... | |
bool | ProbabilisticDelay () const |
if delay has a chance of occurring More... | |
![]() | |
void | DoStep () override |
The MCMC step proposal and acceptance. More... | |
void | ProposeStep () override |
Propose a step. More... | |
double | AcceptanceProbability () override |
Step acceptance probability. More... | |
![]() | |
void | DoMCMCStep () |
The full StartStep->DoStep->EndStep chain. More... | |
void | PreStepProcess () |
Actions before step proposal [start stopwatch]. More... | |
void | PostStepProcess () |
Actions after step proposal [end stopwatch, fill tree]. More... | |
bool | IsStepAccepted (const double acc_prob) |
Is step accepted? More... | |
void | AcceptStep () |
Accept a step. More... | |
void | AdaptiveStep () |
Adaptive MCMC step. More... | |
void | PrintProgress () |
Print the progress. More... | |
![]() | |
void | ProcessMCMC () |
Process MCMC output. More... | |
void | PrepareOutput () |
Prepare the output file. More... | |
void | SaveOutput () |
Save output and close files. More... | |
void | SanitiseInputs () |
Remove obsolete memory and make other checks before fit starts. More... | |
void | SaveSettings () |
Save the settings that the MCMC was run with. More... | |
bool | GetScaneRange (std::map< std::string, std::vector< double >> &scanRanges) |
YSP: Set up a mapping to store parameters with user-specified ranges, suggested by D. Barrow. More... | |
bool | CheckSkipParameter (const std::vector< std::string > &SkipVector, const std::string &ParamName) const |
KS: Check whether we want to skip parameter using skip vector. More... | |
void | CustomRange (const std::string &ParName, const double sigma, double &ParamShiftValue) |
For comparison with P-Theta we usually have to apply different parameter values then usual 1, 3 sigma. More... | |
Protected Attributes | |
std::vector< std::vector< double > > | current_step_vals |
Store information about the current proposed step. More... | |
std::vector< double > | start_step_scale |
Stores the initial scale for all parameters. More... | |
double | initial_scale |
Scale for (non-delayed) step is initial_scale * start_step_scale. More... | |
double | decay_rate |
How much to decrease the step scale each step. More... | |
int | max_rejections |
How many rejections allowed? More... | |
double | MinLogLikelihood |
Minimum (negative) log-likelihood of proposed steps. More... | |
bool | accepted_delayed |
Was the step we just accepted delayed? More... | |
bool | delay_on_oob_only |
Delay only if we go out of bounds. More... | |
double | delay_probability |
Can delay with probability instead. More... | |
![]() | |
bool | out_of_bounds |
Do we reject based on hitting boundaries in systs. More... | |
bool | accept |
Accept. More... | |
unsigned int | chainLength |
number of steps in chain More... | |
bool | anneal |
simulated annealing More... | |
double | AnnealTemp |
simulated annealing temperature More... | |
![]() | |
manager * | fitMan |
The manager. More... | |
unsigned int | step |
current state More... | |
double | logLCurr |
current likelihood More... | |
double | logLProp |
proposed likelihood More... | |
double | accProb |
current acceptance prob More... | |
int | accCount |
counts accepted steps More... | |
unsigned int | stepStart |
step start, by default 0 if we start from previous chain then it will be different More... | |
std::vector< double > | sample_llh |
store the llh breakdowns More... | |
std::vector< double > | syst_llh |
systematic llh breakdowns More... | |
std::vector< SampleHandlerBase * > | samples |
Sample holder. More... | |
unsigned int | TotalNSamples |
Total number of samples used. More... | |
std::vector< ParameterHandlerBase * > | systematics |
Systematic holder. More... | |
std::unique_ptr< TStopwatch > | clock |
tells global time how long fit took More... | |
std::unique_ptr< TStopwatch > | stepClock |
tells how long single step/fit iteration took More... | |
double | stepTime |
Time of single step. More... | |
std::unique_ptr< TRandom3 > | random |
Random number. More... | |
TFile * | outputFile |
Output. More... | |
TDirectory * | CovFolder |
Output cov folder. More... | |
TDirectory * | SampleFolder |
Output sample folder. More... | |
TTree * | outTree |
Output tree with posteriors. More... | |
int | auto_save |
auto save every N steps More... | |
bool | fTestLikelihood |
Necessary for some fitting algorithms like PSO. More... | |
bool | FileSaved |
Checks if file saved not repeat some operations. More... | |
bool | SettingsSaved |
Checks if setting saved not repeat some operations. More... | |
bool | OutputPrepared |
Checks if output prepared not repeat some operations. More... | |
std::string | AlgorithmName |
Name of fitting algorithm that is being used. More... | |
Implementation of delayed rejection for MR2T2.
Delayed rejection is a method to increase the efficiency of MCMC. It is useful if your chain is not mixing well or if adaptive MCMC is struggling. The idea is to propose increasingly small steps centered on the last rejected step.
To enable delayed rejection, add the following to your config.yaml file:
Delayed MCMC will work "as is" but there are additional options which are set in General::MCMC
DecayRate | This should be less than 1 and tells your algorithm how quickly to decrease the step size. By default this is 0.1 |
MaxRejections | How many steps to delayed-reject before moving on. By default this is 1 and increasing is not recommended |
InitialScale | The initial scale of your proposed steps. I.e. propose step with InitialScale*scale in parameter handler. This allows for a really large/small first step to be proposed. Testing finds the default value of 1 to be most effective with adaptive MCMC |
DelayOnlyOutBounds | Here delaying only happens if a step is thrown out of bounds |
DelayProbability | In order to mitigate the slowness of delayed MCMC, there is a probability of proposing a delayed step. By default this is 1 |
Definition at line 42 of file DelayedMR2T2.h.
DelayedMR2T2::DelayedMR2T2 | ( | manager *const | fitMan | ) |
Constructor.
fitMan | A pointer to a manager object, which will handle all settings. |
Definition at line 4 of file DelayedMR2T2.cpp.
|
virtualdefault |
Destructor.
|
overrideprotectedvirtual |
Step acceptance probability.
Implements MCMCBase.
Definition at line 80 of file DelayedMR2T2.cpp.
|
overrideprotectedvirtual |
The MCMC step proposal.
OOB Check
Probabalistic condition
Implements MCMCBase.
Definition at line 96 of file DelayedMR2T2.cpp.
|
protected |
|
protected |
|
protected |
Reset scale after delay process.
Definition at line 45 of file DelayedMR2T2.cpp.
|
protected |
Set parameter scale to be original_scale* scale.
scale | Multiplicative scale factor |
Definition at line 36 of file DelayedMR2T2.cpp.
|
protected |
|
protected |
Was the step we just accepted delayed?
Definition at line 91 of file DelayedMR2T2.h.
|
protected |
Store information about the current proposed step.
Definition at line 75 of file DelayedMR2T2.h.
|
protected |
How much to decrease the step scale each step.
Definition at line 83 of file DelayedMR2T2.h.
|
protected |
Delay only if we go out of bounds.
Definition at line 94 of file DelayedMR2T2.h.
|
protected |
Can delay with probability instead.
Definition at line 96 of file DelayedMR2T2.h.
|
protected |
Scale for (non-delayed) step is initial_scale * start_step_scale.
Definition at line 81 of file DelayedMR2T2.h.
|
protected |
How many rejections allowed?
Definition at line 85 of file DelayedMR2T2.h.
|
protected |
Minimum (negative) log-likelihood of proposed steps.
Definition at line 88 of file DelayedMR2T2.h.
|
protected |
Stores the initial scale for all parameters.
Definition at line 78 of file DelayedMR2T2.h.