![]() |
MaCh3
2.2.3
Reference Guide
|
Contains information about adaptive covariance matrix [12]. More...
#include <Parameters/AdaptiveMCMCHandler.h>
Public Member Functions | |
AdaptiveMCMCHandler () | |
Constructor. More... | |
virtual | ~AdaptiveMCMCHandler () |
Destructor. More... | |
void | Print () const |
Print all class members. More... | |
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. More... | |
void | CreateNewAdaptiveCovariance () |
If we don't have a covariance matrix to start from for adaptive tune we need to make one! More... | |
void | SetAdaptiveBlocks (const std::vector< std::vector< int >> &block_indices) |
HW: sets adaptive block matrix. More... | |
void | SaveAdaptiveToFile (const std::string &outFileName, const std::string &systematicName, const bool is_final=false) |
HW: Save adaptive throw matrix to file. More... | |
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 More... | |
void | UpdateAdaptiveCovariance () |
Method to update adaptive MCMC [12]. More... | |
bool | IndivStepScaleAdapt () const |
Tell whether we want reset step scale or not. More... | |
bool | UpdateMatrixAdapt () |
Tell whether matrix should be updated. More... | |
bool | AdaptionUpdate () const |
To be fair not a clue... More... | |
bool | SkipAdaption () const |
Tell if we are Skipping Adaption. More... | |
void | SetParams (const std::vector< double > *params) |
Set the current values of the parameters. More... | |
void | SetFixed (const std::vector< double > *fix) |
Set the fixed parameters. More... | |
int | GetNumParams () const |
Get the current values of the parameters. More... | |
bool | IsFixed (const int ipar) const |
Check if a parameter is fixed. More... | |
double | CurrVal (const int par_index) const |
Get Current value of parameter. More... | |
int | GetTotalSteps () const |
Get Total Number of Steps. More... | |
void | SetTotalSteps (const int nsteps) |
Change Total Number of Steps to new value. More... | |
void | IncrementNSteps () |
Increase by one number of total steps. More... | |
TMatrixDSym * | GetAdaptiveCovariance () const |
Increase by one number of total steps. More... | |
std::vector< double > | GetParameterMeans () const |
Get the parameter means used in the adaptive handler. More... | |
std::string | GetOutFileName () const |
Get Name of Output File. More... | |
Private Attributes | |
int | start_adaptive_throw |
int | start_adaptive_update |
When do we stop update the adaptive matrix. More... | |
int | end_adaptive_update |
Steps between changing throw matrix. More... | |
int | adaptive_update_step |
Steps between changing throw matrix. More... | |
int | adaptive_save_n_iterations |
std::string | output_file_name |
Name of the file to save the adaptive matrices into. More... | |
std::vector< int > | adapt_block_matrix_indices |
Indices for block-matrix adaption. More... | |
std::vector< int > | adapt_block_sizes |
Size of blocks for adaption. More... | |
std::vector< double > | par_means |
Mean values for all parameters. More... | |
TMatrixDSym * | adaptive_covariance |
Full adaptive covariance matrix. More... | |
int | total_steps |
Total number of MCMC steps. More... | |
double | adaption_scale |
Scaling factor. More... | |
const std::vector< double > * | _fFixedPars |
Vector of fixed parameters. More... | |
const std::vector< double > * | _fCurrVal |
Current values of parameters. More... | |
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 |
bool adaptive_mcmc::AdaptiveMCMCHandler::AdaptionUpdate | ( | ) | const |
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 | ) | const |
Get Current value of parameter.
HW Implemented as its own method to allow for different behaviour in the future
Definition at line 336 of file AdaptiveMCMCHandler.cpp.
|
inline |
Increase by one number of total steps.
Definition at line 109 of file AdaptiveMCMCHandler.h.
bool adaptive_mcmc::AdaptiveMCMCHandler::IndivStepScaleAdapt | ( | ) | const |
Tell whether we want reset step scale or not.
Definition at line 291 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 | YAML node containing the configuration (AdaptionOptions ). |
matrix_name_str | Name of the covariance matrix block to configure. |
parameters | Pointer to a vector of parameter values (nominal values). |
fixed | Pointer to a vector of fixed parameter values. |
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 87 of file AdaptiveMCMCHandler.h.
void adaptive_mcmc::AdaptiveMCMCHandler::Print | ( | ) | const |
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 76 of file AdaptiveMCMCHandler.h.
|
inline |
Set the current values of the parameters.
Definition at line 71 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 187 of file AdaptiveMCMCHandler.cpp.
|
inline |
Change Total Number of Steps to new value.
Definition at line 104 of file AdaptiveMCMCHandler.h.
bool adaptive_mcmc::AdaptiveMCMCHandler::SkipAdaption | ( | ) | const |
void adaptive_mcmc::AdaptiveMCMCHandler::UpdateAdaptiveCovariance | ( | ) |
Method to update adaptive MCMC [12].
_fCurrVal | Value of each parameter necessary for updating throw matrix |
Definition at line 239 of file AdaptiveMCMCHandler.cpp.
bool adaptive_mcmc::AdaptiveMCMCHandler::UpdateMatrixAdapt | ( | ) |
Tell whether matrix should be updated.
Definition at line 298 of file AdaptiveMCMCHandler.cpp.
|
private |
Current values of parameters.
Definition at line 175 of file AdaptiveMCMCHandler.h.
|
private |
Vector of fixed parameters.
Definition at line 172 of file AdaptiveMCMCHandler.h.
|
private |
Indices for block-matrix adaption.
Definition at line 153 of file AdaptiveMCMCHandler.h.
|
private |
Size of blocks for adaption.
Definition at line 156 of file AdaptiveMCMCHandler.h.
|
private |
Scaling factor.
Definition at line 169 of file AdaptiveMCMCHandler.h.
|
private |
Full adaptive covariance matrix.
Definition at line 163 of file AdaptiveMCMCHandler.h.
|
private |
If you don't want to save every adaption then you can specify this here
Definition at line 147 of file AdaptiveMCMCHandler.h.
|
private |
Steps between changing throw matrix.
Definition at line 143 of file AdaptiveMCMCHandler.h.
|
private |
Steps between changing throw matrix.
Definition at line 140 of file AdaptiveMCMCHandler.h.
|
private |
Name of the file to save the adaptive matrices into.
Definition at line 150 of file AdaptiveMCMCHandler.h.
|
private |
Mean values for all parameters.
Definition at line 160 of file AdaptiveMCMCHandler.h.
|
private |
Meta variables related to adaption run time When do we start throwing
Definition at line 134 of file AdaptiveMCMCHandler.h.
|
private |
When do we stop update the adaptive matrix.
Definition at line 137 of file AdaptiveMCMCHandler.h.
|
private |
Total number of MCMC steps.
Definition at line 166 of file AdaptiveMCMCHandler.h.