![]() |
MaCh3 2.2.1
Reference Guide
|
Contains information about adaptive covariance matrix [12]. More...
#include <Parameters/AdaptiveMCMCHandler.h>
Public Member Functions | |
AdaptiveMCMCHandler () | |
Constructor. | |
virtual | ~AdaptiveMCMCHandler () |
Destructor. | |
void | Print () |
Print all class members. | |
bool | InitFromConfig (const YAML::Node &adapt_manager, const std::string &matrix_name_str, const std::vector< double > *parameters, const std::vector< double > *fixed) |
Read initial values from config file. | |
void | CreateNewAdaptiveCovariance () |
If we don't have a covariance matrix to start from for adaptive tune we need to make one! | |
void | SetAdaptiveBlocks (const std::vector< std::vector< int > > &block_indices) |
HW: sets adaptive block matrix. | |
void | SaveAdaptiveToFile (const std::string &outFileName, const std::string &systematicName, const bool is_final=false) |
HW: Save adaptive throw matrix to file. | |
void | SetThrowMatrixFromFile (const std::string &matrix_file_name, const std::string &matrix_name, const std::string &means_name, bool &use_adaptive) |
sets throw matrix from a file | |
void | UpdateAdaptiveCovariance () |
Method to update adaptive MCMC [12]. | |
bool | IndivStepScaleAdapt () |
Tell whether we want reset step scale or not. | |
bool | UpdateMatrixAdapt () |
Tell whether matrix should be updated. | |
bool | AdaptionUpdate () |
To be fair not a clue... | |
bool | SkipAdaption () |
Tell if we are Skipping Adaption. | |
void | SetParams (const std::vector< double > *params) |
Set the current values of the parameters. | |
void | SetFixed (const std::vector< double > *fix) |
Set the fixed parameters. | |
int | GetNumParams () const |
Get the current values of the parameters. | |
bool | IsFixed (const int ipar) const |
Check if a parameter is fixed. | |
double | CurrVal (const int par_index) |
Get Current value of parameter. | |
int | GetTotalSteps () const |
Get Total Number of Steps. | |
void | SetTotalSteps (const int nsteps) |
Change Total Number of Steps to new value. | |
void | IncrementNSteps () |
Increase by one number of total steps. | |
TMatrixDSym * | GetAdaptiveCovariance () const |
Increase by one number of total steps. | |
std::vector< double > | GetParameterMeans () const |
Get the parameter means used in the adaptive handler. | |
std::string | GetOutFileName () const |
Get Name of Output File. | |
Private Attributes | |
int | start_adaptive_throw |
int | start_adaptive_update |
When do we stop update the adaptive matrix. | |
int | end_adaptive_update |
Steps between changing throw matrix. | |
int | adaptive_update_step |
Steps between changing throw matrix. | |
int | adaptive_save_n_iterations |
std::string | output_file_name |
Name of the file to save the adaptive matrices into. | |
std::vector< int > | adapt_block_matrix_indices |
Indices for block-matrix adaption. | |
std::vector< int > | adapt_block_sizes |
Size of blocks for adaption. | |
std::vector< double > | par_means |
Mean values for all parameters. | |
TMatrixDSym * | adaptive_covariance |
Full adaptive covariance matrix. | |
int | total_steps |
Total number of MCMC steps. | |
double | adaption_scale |
Scaling factor. | |
const std::vector< double > * | _fFixedPars |
Vector of fixed parameters. | |
const std::vector< double > * | _fCurrVal |
Current values of parameters. | |
Contains information about adaptive covariance matrix [12].
struct encapsulating all adaptive MCMC information
Definition at line 13 of file AdaptiveMCMCHandler.h.
adaptive_mcmc::AdaptiveMCMCHandler::AdaptiveMCMCHandler | ( | ) |
Constructor.
Definition at line 6 of file AdaptiveMCMCHandler.cpp.
|
virtual |
Destructor.
Definition at line 19 of file AdaptiveMCMCHandler.cpp.
bool adaptive_mcmc::AdaptiveMCMCHandler::AdaptionUpdate | ( | ) |
To be fair not a clue...
Definition at line 313 of file AdaptiveMCMCHandler.cpp.
void adaptive_mcmc::AdaptiveMCMCHandler::CreateNewAdaptiveCovariance | ( | ) |
If we don't have a covariance matrix to start from for adaptive tune we need to make one!
Definition at line 91 of file AdaptiveMCMCHandler.cpp.
double adaptive_mcmc::AdaptiveMCMCHandler::CurrVal | ( | const int | par_index | ) |
Get Current value of parameter.
HW Implemented as its own method to allow for different behaviour in the future
Definition at line 331 of file AdaptiveMCMCHandler.cpp.
|
inline |
Increase by one number of total steps.
Definition at line 107 of file AdaptiveMCMCHandler.h.
|
inline |
Get the current values of the parameters.
Definition at line 76 of file AdaptiveMCMCHandler.h.
|
inline |
Get Total Number of Steps.
Definition at line 92 of file AdaptiveMCMCHandler.h.
|
inline |
Increase by one number of total steps.
Definition at line 102 of file AdaptiveMCMCHandler.h.
bool adaptive_mcmc::AdaptiveMCMCHandler::IndivStepScaleAdapt | ( | ) |
Tell whether we want reset step scale or not.
Definition at line 286 of file AdaptiveMCMCHandler.cpp.
bool adaptive_mcmc::AdaptiveMCMCHandler::InitFromConfig | ( | const YAML::Node & | adapt_manager, |
const std::string & | matrix_name_str, | ||
const std::vector< double > * | parameters, | ||
const std::vector< double > * | fixed | ||
) |
Read initial values from config file.
adapt_manager | Config file from which we update matrix |
HW: This is technically wrong, should be across all systematics but will be addressed in a later PR
Definition at line 27 of file AdaptiveMCMCHandler.cpp.
|
inline |
Check if a parameter is fixed.
Definition at line 81 of file AdaptiveMCMCHandler.h.
void adaptive_mcmc::AdaptiveMCMCHandler::Print | ( | ) |
Print all class members.
Definition at line 320 of file AdaptiveMCMCHandler.cpp.
void adaptive_mcmc::AdaptiveMCMCHandler::SaveAdaptiveToFile | ( | const std::string & | outFileName, |
const std::string & | systematicName, | ||
const bool | is_final = false |
||
) |
HW: Save adaptive throw matrix to file.
Definition at line 141 of file AdaptiveMCMCHandler.cpp.
void adaptive_mcmc::AdaptiveMCMCHandler::SetAdaptiveBlocks | ( | const std::vector< std::vector< int > > & | block_indices | ) |
HW: sets adaptive block matrix.
block_indices | Values for sub-matrix blocks |
Definition at line 99 of file AdaptiveMCMCHandler.cpp.
|
inline |
Set the fixed parameters.
Definition at line 71 of file AdaptiveMCMCHandler.h.
|
inline |
Set the current values of the parameters.
Definition at line 66 of file AdaptiveMCMCHandler.h.
void adaptive_mcmc::AdaptiveMCMCHandler::SetThrowMatrixFromFile | ( | const std::string & | matrix_file_name, |
const std::string & | matrix_name, | ||
const std::string & | means_name, | ||
bool & | use_adaptive | ||
) |
sets throw matrix from a file
matrix_file_name | name of file matrix lives in |
matrix_name | name of matrix in file |
means_name | name of means vec in file |
Definition at line 182 of file AdaptiveMCMCHandler.cpp.
|
inline |
Change Total Number of Steps to new value.
Definition at line 97 of file AdaptiveMCMCHandler.h.
bool adaptive_mcmc::AdaptiveMCMCHandler::SkipAdaption | ( | ) |
Tell if we are Skipping Adaption.
Definition at line 305 of file AdaptiveMCMCHandler.cpp.
void adaptive_mcmc::AdaptiveMCMCHandler::UpdateAdaptiveCovariance | ( | ) |
Method to update adaptive MCMC [12].
_fCurrVal | Value of each parameter necessary for updating throw matrix |
Definition at line 234 of file AdaptiveMCMCHandler.cpp.
bool adaptive_mcmc::AdaptiveMCMCHandler::UpdateMatrixAdapt | ( | ) |
Tell whether matrix should be updated.
Definition at line 293 of file AdaptiveMCMCHandler.cpp.
|
private |
Current values of parameters.
Definition at line 167 of file AdaptiveMCMCHandler.h.
|
private |
Vector of fixed parameters.
Definition at line 164 of file AdaptiveMCMCHandler.h.
|
private |
Indices for block-matrix adaption.
Definition at line 145 of file AdaptiveMCMCHandler.h.
|
private |
Size of blocks for adaption.
Definition at line 148 of file AdaptiveMCMCHandler.h.
|
private |
Scaling factor.
Definition at line 161 of file AdaptiveMCMCHandler.h.
|
private |
Full adaptive covariance matrix.
Definition at line 155 of file AdaptiveMCMCHandler.h.
|
private |
If you don't want to save every adaption then you can specify this here
Definition at line 139 of file AdaptiveMCMCHandler.h.
|
private |
Steps between changing throw matrix.
Definition at line 135 of file AdaptiveMCMCHandler.h.
|
private |
Steps between changing throw matrix.
Definition at line 132 of file AdaptiveMCMCHandler.h.
|
private |
Name of the file to save the adaptive matrices into.
Definition at line 142 of file AdaptiveMCMCHandler.h.
|
private |
Mean values for all parameters.
Definition at line 152 of file AdaptiveMCMCHandler.h.
|
private |
Meta variables related to adaption run time When do we start throwing
Definition at line 126 of file AdaptiveMCMCHandler.h.
|
private |
When do we stop update the adaptive matrix.
Definition at line 129 of file AdaptiveMCMCHandler.h.
|
private |
Total number of MCMC steps.
Definition at line 158 of file AdaptiveMCMCHandler.h.