queso-0.57.1
|
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 | solveBIP_proc0 (std::vector< ExchangeInfoStruct > &exchangeStdVec) |
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 3985 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 4018 of file MLSampling.C.
|
private |
Writes checkpoint data for the ML method.
[in] | currExponent,currEta,currChain,currLogLikelihoodValues,currLogTargetValues. |
Definition at line 2011 of file MLSampling.C.
References QUESO::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 149 of file MLSampling.C.
References QUESO::ExchangeInfoStruct::finalNodeOfInitialPosition, QUESO::MLSamplingLevelOptions::m_loadBalanceAlgorithmId, QUESO::MLSamplingLevelOptions::m_loadBalanceTreshold, QUESO::ExchangeInfoStruct::numberOfPositions, QUESO::ExchangeInfoStruct::originalIndexOfInitialPosition, QUESO::ExchangeInfoStruct::originalNodeOfInitialPosition, and QUESO::queso_require_equal_to_msg.
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:
\[ \pi (\theta|D, M_j) = \frac{f(D|\theta, M_j) \cdot \pi (\theta | M_j)}{\pi(D, M_j)} \]
where \( \pi (\theta|D, M_j) \) is the posterior PDF, \( \pi (\theta | M_j) \) is the prior, \( f(D|\theta, M_j)\) is the likelihood function and \( \pi(D, M_j) \) is the evidence for a given set of parameters \( \theta \), data \( D \) and model class \( M_j \). Then the EIG can be calculated as:
\[ EIG = log \left(\frac{ \pi (\theta|D, M_j)}{\pi (\theta | M_j) } \right) = log \left(\frac{f(D|\theta, M_j) }{\pi(D, M_j)} \right) = log \left(\frac{f(D|\theta, M_j) }{\pi(D, M_j)} \right) = log \left(f(D|\theta, M_j)\right) - log\left(f(D|\theta, M_j) \right) \]
Definition at line 4842 of file MLSampling.C.
|
private |
[in] | inputOptions,unifiedCovMatrix,rv,balancedLinkControl,@param[out] | workingChain, cumulativeRunTime, cumulativeRejections, currLogLikelihoodValues, currLogTargetValues |
Definition at line 633 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(), QUESO::MLSamplingLevelOptions::m_initialPositionUsePreviousLevelLikelihood, QUESO::MLSamplingLevelOptions::m_rawChainSize, QUESO::MiscGetEllapsedSeconds(), QUESO::MHRawChainInfoStruct::numRejections, 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: \( ln( \pi(D|M) ) = E[ln( \pi(D|\theta,M) )] - E[ln( \pi(\theta|D,M) / \pi(\theta|M) )] \)
Definition at line 4030 of file MLSampling.C.
References QUESO::BalancedLinkedChainsPerNodeStruct< P_V >::balLinkedChains, QUESO::BaseVectorSequence< V, M >::clear(), QUESO::BaseVectorSequence< V, M >::computeFilterParams(), QUESO::BaseVectorSequence< V, M >::computeStatistics(), QUESO::SequenceOfVectors< V, M >::filter(), QUESO::ScalarSequence< T >::filter(), QUESO::SequenceOfVectors< V, M >::getPositionValues(), QUESO::MLSamplingLevelOptions::m_minAcceptableEta, QUESO::MLSamplingLevelOptions::m_parameterDisabledSet, QUESO::MLSamplingLevelOptions::m_rawChainSize, QUESO::MLSamplingLevelOptions::m_stopAtEnd, QUESO::MiscGetEllapsedSeconds(), QUESO::FilePtrSetStruct::ofsVar, QUESO::queso_require_equal_to_msg, 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(), and QUESO::UQ_OK_RC.
|
private |
Generates the sequence at the level 0.
[in] | currOptions | |
[out] | unifiedRequestedNumSamples,currChain,currLogLikelihoodValues,currLogTargetValues |
Definition at line 2298 of file MLSampling.C.
References QUESO::BaseVectorSequence< V, M >::computeStatistics(), QUESO::MLSamplingLevelOptions::m_dataOutputAllowedSet, QUESO::MLSamplingLevelOptions::m_dataOutputFileName, QUESO::MLSamplingLevelOptions::m_filteredChainComputeStats, QUESO::MLSamplingLevelOptions::m_filteredChainGenerate, QUESO::MLSamplingLevelOptions::m_initialValuesOfDisabledParameters, QUESO::MLSamplingLevelOptions::m_prefix, QUESO::MLSamplingLevelOptions::m_rawChainComputeStats, QUESO::MLSamplingLevelOptions::m_rawChainDataOutputFileName, QUESO::MLSamplingLevelOptions::m_rawChainDataOutputFileType, QUESO::MLSamplingLevelOptions::m_rawChainSize, QUESO::MLSamplingLevelOptions::m_rawChainStatisticalOptionsObj, QUESO::MiscGetEllapsedSeconds(), QUESO::FilePtrSetStruct::ofsVar, QUESO::queso_require_equal_to_msg, 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(), 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 2445 of file MLSampling.C.
References QUESO::MLSamplingLevelOptions::m_rawChainSize, QUESO::MiscGetEllapsedSeconds(), 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 2491 of file MLSampling.C.
References QUESO::BaseVectorSequence< V, M >::clear(), QUESO::ScalarSequence< T >::clear(), QUESO::SequenceOfVectors< V, M >::getPositionValues(), QUESO::MLSamplingLevelOptions::m_prefix, QUESO::MiscGetEllapsedSeconds(), QUESO::queso_require_equal_to_msg, 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 2623 of file MLSampling.C.
References QUESO::MLSamplingLevelOptions::m_maxEffectiveSizeRatio, QUESO::MLSamplingLevelOptions::m_minEffectiveSizeRatio, QUESO::MiscCheckForSameValueInAllNodes(), QUESO::MiscGetEllapsedSeconds(), 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 2927 of file MLSampling.C.
References QUESO::SequenceOfVectors< V, M >::getPositionValues(), QUESO::matrixProduct(), QUESO::MiscGetEllapsedSeconds(), 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 3021 of file MLSampling.C.
References QUESO::ScalarSequence< T >::getUnifiedContentsAtProc0Only(), QUESO::MiscGetEllapsedSeconds(), QUESO::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 3101 of file MLSampling.C.
References 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 3134 of file MLSampling.C.
References QUESO::BalancedLinkedChainsPerNodeStruct< P_V >::balLinkedChains, 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 3202 of file MLSampling.C.
References 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 3235 of file MLSampling.C.
References QUESO::BalancedLinkedChainsPerNodeStruct< P_V >::balLinkedChains, QUESO::ScalarSequence< T >::getUnifiedContentsAtProc0Only(), 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_rawChainComputeStats, QUESO::MLSamplingLevelOptions::m_rawChainSize, QUESO::MLSamplingLevelOptions::m_scaleCovMatrix, QUESO::MLSamplingLevelOptions::m_totallyMute, QUESO::MiscCheckForSameValueInAllNodes(), QUESO::MiscGetEllapsedSeconds(), QUESO::queso_require_equal_to_msg, QUESO::BaseEnvironment::subDisplayFile(), 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 3705 of file MLSampling.C.
References QUESO::MLSamplingLevelOptions::m_filteredChainGenerate, QUESO::MLSamplingLevelOptions::m_rawChainComputeStats, 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 3819 of file MLSampling.C.
References QUESO::BaseVectorSequence< V, M >::computeFilterParams(), QUESO::BaseVectorSequence< V, M >::computeStatistics(), QUESO::SequenceOfVectors< V, M >::filter(), QUESO::ScalarSequence< T >::filter(), QUESO::MLSamplingLevelOptions::m_dataOutputAllowedSet, QUESO::MLSamplingLevelOptions::m_dataOutputFileName, QUESO::MLSamplingLevelOptions::m_filteredChainComputeStats, QUESO::MLSamplingLevelOptions::m_filteredChainDataOutputFileName, QUESO::MLSamplingLevelOptions::m_filteredChainDataOutputFileType, QUESO::MLSamplingLevelOptions::m_filteredChainDiscardedPortion, QUESO::MLSamplingLevelOptions::m_filteredChainGenerate, QUESO::MLSamplingLevelOptions::m_filteredChainLag, QUESO::MLSamplingLevelOptions::m_filteredChainStatisticalOptionsObj, QUESO::MLSamplingLevelOptions::m_prefix, QUESO::MLSamplingLevelOptions::m_rawChainComputeStats, QUESO::MLSamplingLevelOptions::m_rawChainDataOutputFileName, QUESO::MLSamplingLevelOptions::m_rawChainDataOutputFileType, QUESO::MLSamplingLevelOptions::m_rawChainStatisticalOptionsObj, QUESO::MiscGetEllapsedSeconds(), QUESO::FilePtrSetStruct::ofsVar, QUESO::queso_require_equal_to_msg, QUESO::BaseVectorSequence< V, M >::setName(), QUESO::ScalarSequence< T >::setName(), QUESO::SequenceOfVectors< V, M >::subSequenceSize(), QUESO::SequenceOfVectors< V, M >::unifiedWriteContents(), QUESO::ScalarSequence< T >::unifiedWriteContents(), and QUESO::UQ_OK_RC.
|
private |
[in] | inputOptions,unifiedCovMatrix,rv,unbalancedLinkControl,indexOfFirstWeight,prevChain | |
[out] | workingChain,cumulativeRunTime,cumulativeRejections,currLogLikelihoodValues,currLogTargetValues |
Definition at line 891 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(), QUESO::MLSamplingLevelOptions::m_initialPositionUsePreviousLevelLikelihood, QUESO::MLSamplingLevelOptions::m_rawChainSize, QUESO::MiscGetEllapsedSeconds(), QUESO::MHRawChainInfoStruct::numRejections, 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 1500 of file MLSampling.C.
References QUESO::MLSamplingLevelOptions::m_loadBalanceTreshold, QUESO::MiscGetEllapsedSeconds(), QUESO::queso_require_equal_to_msg, QUESO::size, 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 4830 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 4836 of file MLSampling.C.
|
private |
[in] | prevChain,exchangeStdVec,finalNumChainsPerNode,finalNumPositionsPerNode | |
[out] | balancedLinkControl |
Definition at line 1788 of file MLSampling.C.
References QUESO::BalancedLinkedChainsPerNodeStruct< P_V >::balLinkedChains, QUESO::SequenceOfVectors< V, M >::getPositionValues(), and QUESO::queso_require_equal_to_msg.
|
private |
[in] | currOptions,prevChain,exchangeStdVec | |
[out] | exchangeStdVec,balancedLinkControl |
Definition at line 330 of file MLSampling.C.
References QUESO::MLSamplingLevelOptions::m_loadBalanceAlgorithmId, and QUESO::queso_require_equal_to_msg.
|
private |
[in] | indexOfFirstWeight,indexOfLastWeight,unifiedIndexCountersAtProc0Only | |
[out] | unbalancedLinkControl |
Definition at line 470 of file MLSampling.C.
References QUESO::UnbalancedLinkedChainControlStruct::initialPositionIndexInPreviousChain, QUESO::UnbalancedLinkedChainControlStruct::numberOfPositions, QUESO::queso_require_equal_to_msg, 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 2118 of file MLSampling.C.
References QUESO::queso_require_equal_to_msg, QUESO::SequenceOfVectors< V, M >::unifiedReadContents(), and QUESO::ScalarSequence< T >::unifiedReadContents().
|
private |
[in] | unifiedRequestedNumSamples,unifiedWeightStdVectorAtProc0Only | |
[out] | unifiedIndexCountersAtProc0Only |
Definition at line 95 of file MLSampling.C.
References QUESO::FiniteDistribution::sample().
|
private |
[in] | exchangeStdVec | |
[out] | exchangeStdVec |
Definition at line 1156 of file MLSampling.C.
References QUESO::BIP_routine_struct::currLevel, QUESO::BIP_routine_struct::env, QUESO::MiscGetEllapsedSeconds(), QUESO::queso_require_equal_to_msg, and QUESO::UQ_OK_RC.
|
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.