queso-0.53.0
|
A templated class that represents a Multilevel generator of samples. More...
#include <MLSampling.h>
Public Member Functions | |
Constructor/Destructor methods | |
MLSampling (const char *prefix, const BaseVectorRV< P_V, P_M > &priorRv, const BaseScalarFunction< P_V, P_M > &likelihoodFunction) | |
Constructor. More... | |
~MLSampling () | |
Destructor. More... | |
Statistical methods | |
void | generateSequence (BaseVectorSequence< P_V, P_M > &workingChain, ScalarSequence< double > *workingLogLikelihoodValues, ScalarSequence< double > *workingLogTargetValues) |
Method to generate the chain. More... | |
double | logEvidence () const |
Method to calculate the logarithm of the evidence. More... | |
double | meanLogLikelihood () const |
Method to calculate the mean of the logarithm of the likelihood. More... | |
double | eig () const |
Calculates the expected information gain value, EIG. More... | |
I/O methods | |
void | print (std::ostream &os) const |
TODO: Prints the sequence. More... | |
Private Member Functions | |
void | checkpointML (double currExponent, double currEta, const SequenceOfVectors< P_V, P_M > &currChain, const ScalarSequence< double > &currLogLikelihoodValues, const ScalarSequence< double > &currLogTargetValues) |
Writes checkpoint data for the ML method. More... | |
void | restartML (double &currExponent, double &currEta, SequenceOfVectors< P_V, P_M > &currChain, ScalarSequence< double > &currLogLikelihoodValues, ScalarSequence< double > &currLogTargetValues) |
Restarts ML algorithm. More... | |
void | generateSequence_Level0_all (const MLSamplingLevelOptions &currOptions, unsigned int &unifiedRequestedNumSamples, SequenceOfVectors< P_V, P_M > &currChain, ScalarSequence< double > &currLogLikelihoodValues, ScalarSequence< double > &currLogTargetValues) |
Generates the sequence at the level 0. More... | |
void | generateSequence_Step01_inter0 (const MLSamplingLevelOptions *currOptions, unsigned int &unifiedRequestedNumSamples) |
Reads options for the ML algorithm (Step 01 from ML algorithm). More... | |
void | generateSequence_Step02_inter0 (const MLSamplingLevelOptions *currOptions, SequenceOfVectors< P_V, P_M > &currChain, ScalarSequence< double > &currLogLikelihoodValues, ScalarSequence< double > &currLogTargetValues, SequenceOfVectors< P_V, P_M > &prevChain, ScalarSequence< double > &prevLogLikelihoodValues, ScalarSequence< double > &prevLogTargetValues, unsigned int &indexOfFirstWeight, unsigned int &indexOfLastWeight) |
Saves chain and corresponding target pdf values from previous level (Step 02 from ML algorithm). More... | |
void | generateSequence_Step03_inter0 (const MLSamplingLevelOptions *currOptions, const ScalarSequence< double > &prevLogLikelihoodValues, double prevExponent, double failedExponent, double &currExponent, ScalarSequence< double > &weightSequence) |
Computes currExponent and sequence of weights for current level and update 'm_logEvidenceFactors' (Step 03 from ML algorithm). More... | |
void | generateSequence_Step04_inter0 (const SequenceOfVectors< P_V, P_M > &prevChain, const ScalarSequence< double > &weightSequence, P_M &unifiedCovMatrix) |
Creates covariance matrix for current level (Step 04 from ML algorithm). More... | |
void | generateSequence_Step05_inter0 (unsigned int unifiedRequestedNumSamples, const ScalarSequence< double > &weightSequence, std::vector< unsigned int > &unifiedIndexCountersAtProc0Only, std::vector< double > &unifiedWeightStdVectorAtProc0Only) |
Creates unified finite distribution for current level (Step 05 from ML algorithm). More... | |
void | generateSequence_Step06_all (const MLSamplingLevelOptions *currOptions, unsigned int indexOfFirstWeight, unsigned int indexOfLastWeight, const std::vector< unsigned int > &unifiedIndexCountersAtProc0Only, bool &useBalancedChains, std::vector< ExchangeInfoStruct > &exchangeStdVec) |
Decides on wheter or not to use balanced chains (Step 06 from ML algorithm). More... | |
void | generateSequence_Step07_inter0 (bool useBalancedChains, unsigned int indexOfFirstWeight, unsigned int indexOfLastWeight, const std::vector< unsigned int > &unifiedIndexCountersAtProc0Only, UnbalancedLinkedChainsPerNodeStruct &unbalancedLinkControl, const MLSamplingLevelOptions *currOptions, const SequenceOfVectors< P_V, P_M > &prevChain, double prevExponent, double currExponent, const ScalarSequence< double > &prevLogLikelihoodValues, const ScalarSequence< double > &prevLogTargetValues, std::vector< ExchangeInfoStruct > &exchangeStdVec, BalancedLinkedChainsPerNodeStruct< P_V > &balancedLinkControl) |
Plans for number of linked chains for each node so that all nodes generate the closest possible to the same number of positions (Step 07 from ML algorithm). More... | |
void | generateSequence_Step08_all (BayesianJointPdf< P_V, P_M > &currPdf, GenericVectorRV< P_V, P_M > &currRv) |
Creates a vector RV for current level (Step 08 from ML algorithm). More... | |
void | generateSequence_Step09_all (const SequenceOfVectors< P_V, P_M > &prevChain, double prevExponent, double currExponent, const ScalarSequence< double > &prevLogLikelihoodValues, const ScalarSequence< double > &prevLogTargetValues, unsigned int indexOfFirstWeight, unsigned int indexOfLastWeight, const std::vector< double > &unifiedWeightStdVectorAtProc0Only, const ScalarSequence< double > &weightSequence, double prevEta, const GenericVectorRV< P_V, P_M > &currRv, MLSamplingLevelOptions *currOptions, P_M &unifiedCovMatrix, double &currEta) |
Scales the unified covariance matrix until min <= rejection rate <= max (Step 09 from ML algorithm). More... | |
void | generateSequence_Step10_all (MLSamplingLevelOptions &currOptions, const P_M &unifiedCovMatrix, const GenericVectorRV< P_V, P_M > &currRv, bool useBalancedChains, const UnbalancedLinkedChainsPerNodeStruct &unbalancedLinkControl, unsigned int indexOfFirstWeight, const SequenceOfVectors< P_V, P_M > &prevChain, double prevExponent, double currExponent, const ScalarSequence< double > &prevLogLikelihoodValues, const ScalarSequence< double > &prevLogTargetValues, const BalancedLinkedChainsPerNodeStruct< P_V > &balancedLinkControl, SequenceOfVectors< P_V, P_M > &currChain, double &cumulativeRawChainRunTime, unsigned int &cumulativeRawChainRejections, ScalarSequence< double > *currLogLikelihoodValues, ScalarSequence< double > *currLogTargetValues) |
Samples the vector RV of current level (Step 10 from ML algorithm). More... | |
void | generateSequence_Step11_inter0 (const MLSamplingLevelOptions *currOptions, unsigned int unifiedRequestedNumSamples, unsigned int cumulativeRawChainRejections, SequenceOfVectors< P_V, P_M > &currChain, ScalarSequence< double > &currLogLikelihoodValues, ScalarSequence< double > &currLogTargetValues, unsigned int &unifiedNumberOfRejections) |
Filters chain (Step 11 from ML algorithm). More... | |
void | sampleIndexes_proc0 (unsigned int unifiedRequestedNumSamples, const std::vector< double > &unifiedWeightStdVectorAtProc0Only, std::vector< unsigned int > &unifiedIndexCountersAtProc0Only) |
bool | decideOnBalancedChains_all (const MLSamplingLevelOptions *currOptions, unsigned int indexOfFirstWeight, unsigned int indexOfLastWeight, const std::vector< unsigned int > &unifiedIndexCountersAtProc0Only, std::vector< ExchangeInfoStruct > &exchangeStdVec) |
void | prepareBalLinkedChains_inter0 (const MLSamplingLevelOptions *currOptions, const SequenceOfVectors< P_V, P_M > &prevChain, double prevExponent, double currExponent, const ScalarSequence< double > &prevLogLikelihoodValues, const ScalarSequence< double > &prevLogTargetValues, std::vector< ExchangeInfoStruct > &exchangeStdVec, BalancedLinkedChainsPerNodeStruct< P_V > &balancedLinkControl) |
void | prepareUnbLinkedChains_inter0 (unsigned int indexOfFirstWeight, unsigned int indexOfLastWeight, const std::vector< unsigned int > &unifiedIndexCountersAtProc0Only, UnbalancedLinkedChainsPerNodeStruct &unbalancedLinkControl) |
void | generateBalLinkedChains_all (MLSamplingLevelOptions &inputOptions, const P_M &unifiedCovMatrix, const GenericVectorRV< P_V, P_M > &rv, const BalancedLinkedChainsPerNodeStruct< P_V > &balancedLinkControl, SequenceOfVectors< P_V, P_M > &workingChain, double &cumulativeRunTime, unsigned int &cumulativeRejections, ScalarSequence< double > *currLogLikelihoodValues, ScalarSequence< double > *currLogTargetValues) |
void | generateUnbLinkedChains_all (MLSamplingLevelOptions &inputOptions, const P_M &unifiedCovMatrix, const GenericVectorRV< P_V, P_M > &rv, const UnbalancedLinkedChainsPerNodeStruct &unbalancedLinkControl, unsigned int indexOfFirstWeight, const SequenceOfVectors< P_V, P_M > &prevChain, double prevExponent, double currExponent, const ScalarSequence< double > &prevLogLikelihoodValues, const ScalarSequence< double > &prevLogTargetValues, SequenceOfVectors< P_V, P_M > &workingChain, double &cumulativeRunTime, unsigned int &cumulativeRejections, ScalarSequence< double > *currLogLikelihoodValues, ScalarSequence< double > *currLogTargetValues) |
void | justBalance_proc0 (const MLSamplingLevelOptions *currOptions, std::vector< ExchangeInfoStruct > &exchangeStdVec) |
void | mpiExchangePositions_inter0 (const SequenceOfVectors< P_V, P_M > &prevChain, double prevExponent, double currExponent, const ScalarSequence< double > &prevLogLikelihoodValues, const ScalarSequence< double > &prevLogTargetValues, const std::vector< ExchangeInfoStruct > &exchangeStdVec, const std::vector< unsigned int > &finalNumChainsPerNode, const std::vector< unsigned int > &finalNumPositionsPerNode, BalancedLinkedChainsPerNodeStruct< P_V > &balancedLinkControl) |
Private Attributes | |
const BaseEnvironment & | m_env |
Queso enviroment. More... | |
const BaseVectorRV< P_V, P_M > & | m_priorRv |
Prior RV. More... | |
const BaseScalarFunction< P_V, P_M > & | m_likelihoodFunction |
Likelihood function. More... | |
const VectorSpace< P_V, P_M > & | m_vectorSpace |
Vector space. More... | |
VectorSet< P_V, P_M > * | m_targetDomain |
Domain of the target PDF: intersection of the domains of the prior PDf and likelihood function. More... | |
unsigned int | m_numDisabledParameters |
std::vector< bool > | m_parameterEnabledStatus |
MLSamplingOptions | m_options |
Options for the ML algorithm. More... | |
unsigned int | m_currLevel |
Current level. More... | |
unsigned int | m_currStep |
Curret step. More... | |
double | m_debugExponent |
Exponent for debugging. More... | |
std::vector< double > | m_logEvidenceFactors |
double | m_logEvidence |
double | m_meanLogLikelihood |
double | m_eig |
Friends | |
std::ostream & | operator<< (std::ostream &os, const MLSampling< P_V, P_M > &obj) |
A templated class that represents a Multilevel generator of samples.
A templated class that represents a Multilevel sampler. Options reading is handled by class 'MLSamplingOptions'. It implements the method: S. H. Cheung and E. E. Prudencio. Parallel adaptive multilevel sampling algorithms for the Bayesian analysis of mathematical models. International Journal for Uncertainty Quantification, 2(3):215237, 2012.
Definition at line 122 of file MLSampling.h.
QUESO::MLSampling< P_V, P_M >::MLSampling | ( | const char * | prefix, |
const BaseVectorRV< P_V, P_M > & | priorRv, | ||
const BaseScalarFunction< P_V, P_M > & | likelihoodFunction | ||
) |
Constructor.
Constructor: instantiates an object of the class given a prefix, the prior RV and the likelihood function. Internally, this method set the domain of the target PDF to be the intersection of the domains of the prior PDF and of the likelihood function. Also the current level and exponent of the Multilevel method are set to zero.
prefix | Prefix |
priorRv | The prior rv |
likelihoodFunction | The likelihood function |
Definition at line 3978 of file MLSampling.C.
References QUESO::MLSampling< P_V, P_M >::m_env, and QUESO::BaseEnvironment::subDisplayFile().
QUESO::MLSampling< P_V, P_M >::~MLSampling | ( | ) |
Destructor.
Definition at line 4011 of file MLSampling.C.
|
private |
Writes checkpoint data for the ML method.
[in] | currExponent,currEta,currChain,currLogLikelihoodValues,currLogTargetValues. |
Definition at line 2004 of file MLSampling.C.
References LEVEL_REF_ID, queso_require_equal_to_msg, QUESO::BaseVectorSequence< V, M >::unifiedSequenceSize(), QUESO::ScalarSequence< T >::unifiedSequenceSize(), QUESO::SequenceOfVectors< V, M >::unifiedWriteContents(), and QUESO::ScalarSequence< T >::unifiedWriteContents().
|
private |
[in] | currOptions,indexOfFirstWeight,indexOfLastWeight,unifiedIndexCountersAtProc0Only | |
[out] | exchangeStdVec |
Definition at line 144 of file MLSampling.C.
References QUESO::ExchangeInfoStruct::finalNodeOfInitialPosition, LEVEL_REF_ID, QUESO::MLSamplingLevelOptions::m_loadBalanceAlgorithmId, QUESO::MLSamplingLevelOptions::m_loadBalanceTreshold, QUESO::ExchangeInfoStruct::numberOfPositions, QUESO::ExchangeInfoStruct::originalIndexOfInitialPosition, QUESO::ExchangeInfoStruct::originalNodeOfInitialPosition, queso_error_msg, queso_require_equal_to_msg, and RawValue_MPI_UNSIGNED.
double QUESO::MLSampling< P_V, P_M >::eig | ( | ) | const |
Calculates the expected information gain value, EIG.
The expected information gain is defined as the expected log ratio between the posterior and prior distribution for the parameters in the statistical model. Recalling the Bayes formula:
where is the posterior PDF, is the prior, is the likelihood function and is the evidence for a given set of parameters , data and model class . Then the EIG can be calculated as:
Definition at line 4835 of file MLSampling.C.
|
private |
[in] | inputOptions,unifiedCovMatrix,rv,balancedLinkControl,@param[out] | workingChain, cumulativeRunTime, cumulativeRejections, currLogLikelihoodValues, currLogTargetValues |
Definition at line 628 of file MLSampling.C.
References QUESO::BaseVectorSequence< V, M >::append(), QUESO::ScalarSequence< T >::append(), QUESO::BalancedLinkedChainsPerNodeStruct< P_V >::balLinkedChains, QUESO::MetropolisHastingsSG< P_V, P_M >::generateSequence(), QUESO::SequenceOfVectors< V, M >::getPositionValues(), QUESO::MetropolisHastingsSG< P_V, P_M >::getRawChainInfo(), LEVEL_REF_ID, QUESO::MLSamplingLevelOptions::m_initialPositionUsePreviousLevelLikelihood, QUESO::MLSamplingLevelOptions::m_rawChainSize, QUESO::MiscGetEllapsedSeconds(), QUESO::MHRawChainInfoStruct::numRejections, RawValue_MPI_DOUBLE, RawValue_MPI_MAX, RawValue_MPI_MIN, RawValue_MPI_SUM, RawValue_MPI_UNSIGNED, QUESO::MHRawChainInfoStruct::runTime, QUESO::SequenceOfVectors< V, M >::subSequenceSize(), and QUESO::ScalarSequence< T >::subSequenceSize().
void QUESO::MLSampling< P_V, P_M >::generateSequence | ( | BaseVectorSequence< P_V, P_M > & | workingChain, |
ScalarSequence< double > * | workingLogLikelihoodValues, | ||
ScalarSequence< double > * | workingLogTargetValues | ||
) |
Method to generate the chain.
Requirement: the vector space 'm_vectorSpace' should have dimension equal to the size of a
vector in 'workingChain'. If the requirement is satisfied, this operation sets the size and the contents of 'workingChain' using the algorithm options set in the constructor. If not NULL, 'workingLogLikelihoodValues' and 'workingLogTargetValues' are set accordingly. This operation currently implements the The Parallel Adaptive Multilevel Stochastic Simulation Algorithm (PAMSSA).
It consists of 11 steps:
At the end, the method computes information gain:
Definition at line 4023 of file MLSampling.C.
References QUESO::BalancedLinkedChainsPerNodeStruct< P_V >::balLinkedChains, QUESO::BaseVectorSequence< V, M >::clear(), QUESO::BaseVectorSequence< V, M >::computeFilterParams(), QUESO::SequenceOfVectors< V, M >::filter(), QUESO::ScalarSequence< T >::filter(), QUESO::SequenceOfVectors< V, M >::getPositionValues(), LEVEL_REF_ID, QUESO::MLSamplingLevelOptions::m_minAcceptableEta, QUESO::MLSamplingLevelOptions::m_parameterDisabledSet, QUESO::MLSamplingLevelOptions::m_rawChainSize, QUESO::MLSamplingLevelOptions::m_stopAtEnd, QUESO::MiscGetEllapsedSeconds(), QUESO::FilePtrSetStruct::ofsVar, queso_require_equal_to_msg, queso_require_msg, RawValue_MPI_DOUBLE, RawValue_MPI_MAX, RawValue_MPI_MIN, RawValue_MPI_SUM, RawValue_MPI_UNSIGNED, QUESO::BaseVectorSequence< V, M >::resizeSequence(), QUESO::MLSamplingLevelOptions::scanOptionsValues(), QUESO::BaseVectorSequence< V, M >::setName(), QUESO::ScalarSequence< T >::setName(), QUESO::BaseVectorSequence< V, M >::setPositionValues(), QUESO::ScalarSequence< T >::subMinMaxExtra(), QUESO::BaseVectorSequence< V, M >::subSequenceSize(), QUESO::SequenceOfVectors< V, M >::subSequenceSize(), QUESO::ScalarSequence< T >::subSequenceSize(), QUESO::ScalarSequence< T >::unifiedMeanExtra(), QUESO::ScalarSequence< T >::unifiedMeanPlain(), QUESO::ScalarSequence< T >::unifiedMinMaxExtra(), QUESO::SequenceOfVectors< V, M >::unifiedWriteContents(), QUESO::ScalarSequence< T >::unifiedWriteContents(), UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT, UQ_MH_SG_FILENAME_FOR_NO_FILE, and QUESO::UQ_OK_RC.
Referenced by QUESO::GpmsaComputerModel< S_V, S_M, D_V, D_M, P_V, P_M, Q_V, Q_M >::calibrateWithBayesMLSampling().
|
private |
Generates the sequence at the level 0.
[in] | currOptions | |
[out] | unifiedRequestedNumSamples,currChain,currLogLikelihoodValues,currLogTargetValues |
Definition at line 2291 of file MLSampling.C.
References LEVEL_REF_ID, QUESO::MLSamplingLevelOptions::m_dataOutputAllowedSet, QUESO::MLSamplingLevelOptions::m_dataOutputFileName, QUESO::MLSamplingLevelOptions::m_filteredChainGenerate, QUESO::MLSamplingLevelOptions::m_initialValuesOfDisabledParameters, QUESO::MLSamplingLevelOptions::m_prefix, QUESO::MLSamplingLevelOptions::m_rawChainDataOutputFileName, QUESO::MLSamplingLevelOptions::m_rawChainDataOutputFileType, QUESO::MLSamplingLevelOptions::m_rawChainSize, QUESO::MiscGetEllapsedSeconds(), QUESO::FilePtrSetStruct::ofsVar, queso_require_equal_to_msg, RawValue_MPI_SUM, RawValue_MPI_UNSIGNED, QUESO::SequenceOfVectors< V, M >::resizeSequence(), QUESO::ScalarSequence< T >::resizeSequence(), QUESO::BaseVectorSequence< V, M >::setName(), QUESO::ScalarSequence< T >::setName(), QUESO::SequenceOfVectors< V, M >::setPositionValues(), QUESO::SequenceOfVectors< V, M >::subSequenceSize(), QUESO::SequenceOfVectors< V, M >::unifiedWriteContents(), QUESO::ScalarSequence< T >::unifiedWriteContents(), UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT, UQ_MH_SG_FILENAME_FOR_NO_FILE, and QUESO::UQ_OK_RC.
|
private |
Reads options for the ML algorithm (Step 01 from ML algorithm).
This method is responsible for the Step 01 in the ML algorithm implemented/described in the method MLSampling<P_V,P_M>::generateSequence.
[in] | currOptions | |
[out] | unifiedRequestedNumSamples |
Definition at line 2438 of file MLSampling.C.
References LEVEL_REF_ID, QUESO::MLSamplingLevelOptions::m_rawChainSize, QUESO::MiscGetEllapsedSeconds(), RawValue_MPI_SUM, RawValue_MPI_UNSIGNED, and QUESO::UQ_OK_RC.
|
private |
Saves chain and corresponding target pdf values from previous level (Step 02 from ML algorithm).
This method is responsible for the Step 02 in the ML algorithm implemented/described in the method MLSampling<P_V,P_M>::generateSequence.
[in] | currOptions | |
[in,out] | currChain,currLogLikelihoodValues,currLogTargetValues | |
[out] | prevChain,prevLogLikelihoodValues,prevLogTargetValues,indexOfFirstWeight,indexOfLastWeight |
Definition at line 2484 of file MLSampling.C.
References QUESO::BaseVectorSequence< V, M >::clear(), QUESO::ScalarSequence< T >::clear(), QUESO::SequenceOfVectors< V, M >::getPositionValues(), LEVEL_REF_ID, QUESO::MLSamplingLevelOptions::m_prefix, QUESO::MiscGetEllapsedSeconds(), queso_require_equal_to_msg, RawValue_MPI_UNSIGNED, QUESO::BaseVectorSequence< V, M >::setName(), QUESO::ScalarSequence< T >::setName(), QUESO::SequenceOfVectors< V, M >::subSequenceSize(), QUESO::ScalarSequence< T >::subSequenceSize(), QUESO::BaseVectorSequence< V, M >::unifiedSequenceSize(), QUESO::ScalarSequence< T >::unifiedSequenceSize(), and QUESO::UQ_OK_RC.
|
private |
Computes currExponent
and sequence of weights for current level and update 'm_logEvidenceFactors' (Step 03 from ML algorithm).
This method is responsible for the Step 03 in the ML algorithm implemented/described in the method MLSampling<P_V,P_M>::generateSequence.
[in] | currOptions,prevLogLikelihoodValues,prevExponent,failedExponent | |
[out] | currExponent,weightSequence |
Definition at line 2616 of file MLSampling.C.
References LEVEL_REF_ID, QUESO::MLSamplingLevelOptions::m_maxEffectiveSizeRatio, QUESO::MLSamplingLevelOptions::m_minEffectiveSizeRatio, QUESO::MiscCheckForSameValueInAllNodes(), QUESO::MiscGetEllapsedSeconds(), queso_require_less_equal_msg, RawValue_MPI_DOUBLE, RawValue_MPI_SUM, QUESO::ScalarSequence< T >::subSequenceSize(), QUESO::ScalarSequence< T >::unifiedMaxPlain(), QUESO::ScalarSequence< T >::unifiedSequenceSize(), and QUESO::UQ_OK_RC.
|
private |
Creates covariance matrix for current level (Step 04 from ML algorithm).
This method is responsible for the Step 04 in the ML algorithm implemented/described in the method MLSampling<P_V,P_M>::generateSequence.
[in] | prevChain,weightSequence | |
[out] | unifiedCovMatrix |
Definition at line 2920 of file MLSampling.C.
References QUESO::SequenceOfVectors< V, M >::getPositionValues(), LEVEL_REF_ID, QUESO::matrixProduct(), QUESO::MiscGetEllapsedSeconds(), RawValue_MPI_DOUBLE, RawValue_MPI_SUM, QUESO::ScalarSequence< T >::subSequenceSize(), and QUESO::UQ_OK_RC.
|
private |
Creates unified finite distribution for current level (Step 05 from ML algorithm).
This method is responsible for the Step 05 in the ML algorithm implemented/described in the method MLSampling<P_V,P_M>::generateSequence.
[in] | unifiedRequestedNumSamples,weightSequence | |
[out] | unifiedIndexCountersAtProc0Only,unifiedWeightStdVectorAtProc0Only |
Definition at line 3014 of file MLSampling.C.
References QUESO::ScalarSequence< T >::getUnifiedContentsAtProc0Only(), LEVEL_REF_ID, QUESO::MiscGetEllapsedSeconds(), queso_require_equal_to_msg, QUESO::ScalarSequence< T >::subSequenceSize(), QUESO::ScalarSequence< T >::unifiedSequenceSize(), and QUESO::UQ_OK_RC.
|
private |
Decides on wheter or not to use balanced chains (Step 06 from ML algorithm).
This method is responsible for the Step 06 in the ML algorithm implemented/described in the method MLSampling<P_V,P_M>::generateSequence.
[in] | currOptions,indexOfFirstWeight,indexOfLastWeight,unifiedIndexCountersAtProc0Only | |
[out] | useBalancedChains,exchangeStdVec |
Definition at line 3094 of file MLSampling.C.
References LEVEL_REF_ID, QUESO::MiscGetEllapsedSeconds(), and QUESO::UQ_OK_RC.
|
private |
Plans for number of linked chains for each node so that all nodes generate the closest possible to the same number of positions (Step 07 from ML algorithm).
This method is responsible for the Step 07 in the ML algorithm implemented/described in the method MLSampling<P_V,P_M>::generateSequence.
[in] | useBalancedChains,indexOfFirstWeight,indexOfLastWeight,unifiedIndexCountersAtProc0Only,currOptions,prevChain,prevExponent,currExponent,prevLogLikelihoodValues,prevLogTargetValues | |
[in,out] | exchangeStdVec | |
[out] | unbalancedLinkControl,balancedLinkControl |
Definition at line 3127 of file MLSampling.C.
References QUESO::BalancedLinkedChainsPerNodeStruct< P_V >::balLinkedChains, LEVEL_REF_ID, QUESO::MiscGetEllapsedSeconds(), QUESO::UnbalancedLinkedChainsPerNodeStruct::unbLinkedChains, and QUESO::UQ_OK_RC.
|
private |
Creates a vector RV for current level (Step 08 from ML algorithm).
This method is responsible for the Step 08 in the ML algorithm implemented/described in the method MLSampling<P_V,P_M>::generateSequence.
[in,out] | currPdf | |
[out] | currRv |
Definition at line 3195 of file MLSampling.C.
References LEVEL_REF_ID, QUESO::MiscGetEllapsedSeconds(), QUESO::GenericVectorRV< V, M >::setPdf(), and QUESO::UQ_OK_RC.
|
private |
Scales the unified covariance matrix until min <= rejection rate <= max (Step 09 from ML algorithm).
This method is responsible for the Step 09 in the ML algorithm implemented/described in the method MLSampling<P_V,P_M>::generateSequence.
[in] | prevChain,indexOfFirstWeight,indexOfLastWeight,unifiedWeightStdVectorAtProc0Only,weightSequence,prevEta,currRv,currOptions,@param[in,out] | unifiedCovMatrix |
[out] | currEta |
Definition at line 3228 of file MLSampling.C.
References QUESO::BalancedLinkedChainsPerNodeStruct< P_V >::balLinkedChains, QUESO::ScalarSequence< T >::getUnifiedContentsAtProc0Only(), LEVEL_REF_ID, QUESO::MLSamplingLevelOptions::m_amAdaptInterval, QUESO::MLSamplingLevelOptions::m_covRejectionRate, QUESO::MLSamplingLevelOptions::m_drMaxNumExtraStages, QUESO::MLSamplingLevelOptions::m_filteredChainGenerate, QUESO::MLSamplingLevelOptions::m_maxRejectionRate, QUESO::MLSamplingLevelOptions::m_minRejectionRate, QUESO::MLSamplingLevelOptions::m_rawChainSize, QUESO::MLSamplingLevelOptions::m_scaleCovMatrix, QUESO::MLSamplingLevelOptions::m_totallyMute, QUESO::MiscCheckForSameValueInAllNodes(), QUESO::MiscGetEllapsedSeconds(), queso_error_msg, queso_require_equal_to_msg, queso_require_msg, RawValue_MPI_SUM, RawValue_MPI_UNSIGNED, QUESO::ScalarSequence< T >::subSequenceSize(), QUESO::ScalarSequence< T >::unifiedSequenceSize(), and QUESO::UQ_OK_RC.
|
private |
Samples the vector RV of current level (Step 10 from ML algorithm).
This method is responsible for the Step 10 in the ML algorithm implemented/described in the method MLSampling<P_V,P_M>::generateSequence.
[in] | currOptions,unifiedCovMatrix,currRv,useBalancedChains,unbalancedLinkControl,indexOfFirstWeight,prevChain,balancedLinkControl | |
[out] | currChain,cumulativeRawChainRunTime,cumulativeRawChainRejections,currLogLikelihoodValues,currLogTargetValues |
Definition at line 3698 of file MLSampling.C.
References LEVEL_REF_ID, QUESO::MLSamplingLevelOptions::m_filteredChainGenerate, QUESO::MLSamplingLevelOptions::m_rawChainSize, QUESO::MLSamplingLevelOptions::m_totallyMute, QUESO::MiscGetEllapsedSeconds(), and QUESO::UQ_OK_RC.
|
private |
Filters chain (Step 11 from ML algorithm).
This method is responsible for the Step 11 in the ML algorithm implemented/described in the method MLSampling<P_V,P_M>::generateSequence.
[in] | currOptions,unifiedRequestedNumSamples,cumulativeRawChainRejections,@param[in,out] | currChain, currLogLikelihoodValues, currLogTargetValues |
[out] | unifiedNumberOfRejections |
Definition at line 3812 of file MLSampling.C.
References QUESO::BaseVectorSequence< V, M >::computeFilterParams(), QUESO::SequenceOfVectors< V, M >::filter(), QUESO::ScalarSequence< T >::filter(), LEVEL_REF_ID, QUESO::MLSamplingLevelOptions::m_dataOutputAllowedSet, QUESO::MLSamplingLevelOptions::m_dataOutputFileName, QUESO::MLSamplingLevelOptions::m_filteredChainDataOutputFileName, QUESO::MLSamplingLevelOptions::m_filteredChainDataOutputFileType, QUESO::MLSamplingLevelOptions::m_filteredChainDiscardedPortion, QUESO::MLSamplingLevelOptions::m_filteredChainGenerate, QUESO::MLSamplingLevelOptions::m_filteredChainLag, QUESO::MLSamplingLevelOptions::m_prefix, QUESO::MLSamplingLevelOptions::m_rawChainDataOutputFileName, QUESO::MLSamplingLevelOptions::m_rawChainDataOutputFileType, QUESO::MiscGetEllapsedSeconds(), QUESO::FilePtrSetStruct::ofsVar, queso_require_equal_to_msg, RawValue_MPI_SUM, RawValue_MPI_UNSIGNED, QUESO::BaseVectorSequence< V, M >::setName(), QUESO::ScalarSequence< T >::setName(), QUESO::SequenceOfVectors< V, M >::subSequenceSize(), QUESO::SequenceOfVectors< V, M >::unifiedWriteContents(), QUESO::ScalarSequence< T >::unifiedWriteContents(), UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT, UQ_MH_SG_FILENAME_FOR_NO_FILE, and QUESO::UQ_OK_RC.
|
private |
[in] | inputOptions,unifiedCovMatrix,rv,unbalancedLinkControl,indexOfFirstWeight,prevChain | |
[out] | workingChain,cumulativeRunTime,cumulativeRejections,currLogLikelihoodValues,currLogTargetValues |
Definition at line 886 of file MLSampling.C.
References QUESO::BaseVectorSequence< V, M >::append(), QUESO::ScalarSequence< T >::append(), QUESO::MetropolisHastingsSG< P_V, P_M >::generateSequence(), QUESO::SequenceOfVectors< V, M >::getPositionValues(), QUESO::MetropolisHastingsSG< P_V, P_M >::getRawChainInfo(), LEVEL_REF_ID, QUESO::MLSamplingLevelOptions::m_initialPositionUsePreviousLevelLikelihood, QUESO::MLSamplingLevelOptions::m_rawChainSize, QUESO::MiscGetEllapsedSeconds(), QUESO::MHRawChainInfoStruct::numRejections, RawValue_MPI_DOUBLE, RawValue_MPI_MAX, RawValue_MPI_MIN, RawValue_MPI_SUM, RawValue_MPI_UNSIGNED, QUESO::MHRawChainInfoStruct::runTime, QUESO::SequenceOfVectors< V, M >::subSequenceSize(), QUESO::ScalarSequence< T >::subSequenceSize(), and QUESO::UnbalancedLinkedChainsPerNodeStruct::unbLinkedChains.
|
private |
[in] | currOptions,exchangeStdVec | |
[out] | exchangeStdVec |
Definition at line 1495 of file MLSampling.C.
References LEVEL_REF_ID, QUESO::MLSamplingLevelOptions::m_loadBalanceTreshold, QUESO::MiscGetEllapsedSeconds(), queso_require_equal_to_msg, and QUESO::UQ_OK_RC.
double QUESO::MLSampling< P_V, P_M >::logEvidence | ( | ) | const |
Method to calculate the logarithm of the evidence.
Access to the private member: m_logEvidence
.
Definition at line 4823 of file MLSampling.C.
double QUESO::MLSampling< P_V, P_M >::meanLogLikelihood | ( | ) | const |
Method to calculate the mean of the logarithm of the likelihood.
Access to the private member: m_meanLogLikelihood
.
Definition at line 4829 of file MLSampling.C.
|
private |
[in] | prevChain,exchangeStdVec,finalNumChainsPerNode,finalNumPositionsPerNode | |
[out] | balancedLinkControl |
Definition at line 1783 of file MLSampling.C.
References QUESO::BalancedLinkedChainsPerNodeStruct< P_V >::balLinkedChains, QUESO::SequenceOfVectors< V, M >::getPositionValues(), LEVEL_REF_ID, queso_require_equal_to_msg, RawValue_MPI_DOUBLE, and RawValue_MPI_IN_PLACE.
|
private |
[in] | currOptions,prevChain,exchangeStdVec | |
[out] | exchangeStdVec,balancedLinkControl |
Definition at line 325 of file MLSampling.C.
References LEVEL_REF_ID, QUESO::MLSamplingLevelOptions::m_loadBalanceAlgorithmId, queso_require_equal_to_msg, RawValue_MPI_CHAR, RawValue_MPI_DOUBLE, RawValue_MPI_MAX, RawValue_MPI_MIN, and RawValue_MPI_UNSIGNED.
|
private |
[in] | indexOfFirstWeight,indexOfLastWeight,unifiedIndexCountersAtProc0Only | |
[out] | unbalancedLinkControl |
Definition at line 465 of file MLSampling.C.
References QUESO::UnbalancedLinkedChainControlStruct::initialPositionIndexInPreviousChain, LEVEL_REF_ID, QUESO::UnbalancedLinkedChainControlStruct::numberOfPositions, queso_error_msg, queso_require_equal_to_msg, queso_require_less_msg, RawValue_MPI_MAX, RawValue_MPI_MIN, RawValue_MPI_SUM, RawValue_MPI_UNSIGNED, and QUESO::UnbalancedLinkedChainsPerNodeStruct::unbLinkedChains.
void QUESO::MLSampling< P_V, P_M >::print | ( | std::ostream & | os | ) | const |
TODO: Prints the sequence.
|
private |
Restarts ML algorithm.
This method reads the control file and determines the number of lines on it; then it reads the stored values, calls MPI_Bcast and processes the read data in all available MPI nodes.
[out] | currExponent,currEta,currChain,currLogLikelihoodValues,currLogTargetValues. |
Definition at line 2111 of file MLSampling.C.
References LEVEL_REF_ID, ML_CHECKPOINT_FIXED_AMOUNT_OF_DATA, queso_require_equal_to_msg, queso_require_msg, RawValue_MPI_DOUBLE, RawValue_MPI_UNSIGNED, QUESO::SequenceOfVectors< V, M >::unifiedReadContents(), and QUESO::ScalarSequence< T >::unifiedReadContents().
|
private |
[in] | unifiedRequestedNumSamples,unifiedWeightStdVectorAtProc0Only | |
[out] | unifiedIndexCountersAtProc0Only |
Definition at line 90 of file MLSampling.C.
References LEVEL_REF_ID, and QUESO::FiniteDistribution::sample().
|
friend |
Definition at line 206 of file MLSampling.h.
|
private |
Current level.
Definition at line 492 of file MLSampling.h.
|
private |
Curret step.
Definition at line 495 of file MLSampling.h.
|
private |
Exponent for debugging.
Definition at line 498 of file MLSampling.h.
|
private |
Definition at line 502 of file MLSampling.h.
|
private |
Queso enviroment.
Definition at line 470 of file MLSampling.h.
Referenced by QUESO::MLSampling< P_V, P_M >::MLSampling().
|
private |
Likelihood function.
Definition at line 476 of file MLSampling.h.
|
private |
Definition at line 500 of file MLSampling.h.
|
private |
Definition at line 499 of file MLSampling.h.
|
private |
Definition at line 501 of file MLSampling.h.
|
private |
Definition at line 484 of file MLSampling.h.
|
private |
Options for the ML algorithm.
Definition at line 489 of file MLSampling.h.
|
private |
Definition at line 486 of file MLSampling.h.
|
private |
Prior RV.
Definition at line 473 of file MLSampling.h.
|
private |
Domain of the target PDF: intersection of the domains of the prior PDf and likelihood function.
Definition at line 482 of file MLSampling.h.
|
private |
Vector space.
Definition at line 479 of file MLSampling.h.