queso-0.57.1
|
This templated class represents a Statistical Inverse Problem. More...
#include <StatisticalInverseProblem.h>
Public Member Functions | |
Constructor/Destructor methods | |
StatisticalInverseProblem (const char *prefix, const SipOptionsValues *alternativeOptionsValues, const BaseVectorRV< P_V, P_M > &priorRv, const BaseScalarFunction< P_V, P_M > &likelihoodFunction, GenericVectorRV< P_V, P_M > &postRv) | |
Constructor. More... | |
StatisticalInverseProblem (const char *prefix, const SipOptionsValues *alternativeOptionsValues, const GPMSAFactory< P_V, P_M > &gpmsaFactory, GenericVectorRV< P_V, P_M > &postRv) | |
Constructor for statistical inverse problems to be sovled using GPMSA. More... | |
~StatisticalInverseProblem () | |
Destructor. More... | |
Statistical methods | |
bool | computeSolutionFlag () const |
Whether or not compute the solution. More... | |
void | solveWithBayesMetropolisHastings (const MhOptionsValues *alternativeOptionsValues, const P_V &initialValues, const P_M *initialProposalCovMatrix) |
Solves the problem via Bayes formula and a Metropolis-Hastings algorithm. More... | |
void | solveWithBayesMetropolisHastings (const MhOptionsValues *alternativeOptionsValues, const P_V &initialValues) |
Solves the problem via Bayes formula and a Metropolis-Hastings algorithm. More... | |
void | solveWithBayesMetropolisHastings (const MhOptionsValues *alternativeOptionsValues) |
Solves the problem via Bayes formula and a Metropolis-Hastings algorithm. More... | |
void | solveWithBayesMetropolisHastings () |
Solves the problem via Bayes formula and a Metropolis-Hastings algorithm. More... | |
void | seedWithMAPEstimator () |
Seeds the chain with the result of a deterministic optimisation. More... | |
void | solveWithBayesMLSampling () |
Solves with Bayes Multi-Level (ML) sampling. More... | |
const MetropolisHastingsSG < P_V, P_M > & | sequenceGenerator () const |
Return the underlying MetropolisHastingSG object. More... | |
const BaseVectorRV< P_V, P_M > & | priorRv () const |
Returns the Prior RV; access to private attribute m_priorRv. More... | |
const GenericVectorRV< P_V, P_M > & | postRv () const |
Returns the Posterior RV; access to private attribute m_postrRv. More... | |
const BaseVectorSequence< P_V, P_M > & | chain () const |
Returns the MCMC chain; access to private attribute m_chain. More... | |
const ScalarSequence< double > & | logLikelihoodValues () const |
Returns log likelihood values; access to private attribute m_logLikelihoodValues. More... | |
const ScalarSequence< double > & | logTargetValues () const |
Returns log target values; access to private attribute m_logTargetValues. More... | |
double | logEvidence () const |
Returns the logarithm value of the evidence. Related to ML. More... | |
double | meanLogLikelihood () const |
Returns the mean of the logarithm value of the likelihood. Related to ML. More... | |
double | eig () const |
I/O methods | |
void | print (std::ostream &os) const |
TODO: Prints the sequence. More... | |
std::ostream & | operator<< (std::ostream &os, const StatisticalInverseProblem< P_V, P_M > &obj) |
This templated class represents a Statistical Inverse Problem.
This class is templated on the type 'P_V' of vector and type 'P_M' of matrix, where 'P_' stands for 'parameter'. Some templated classes might also use 'Q_V' and 'Q_M' when referring to a vector type and a matrix type, where 'Q_' stands for 'quantities of interest'. Conceptually, a statistical inverse problem has two input entities and one output entity.
The input entities of a statistical inverse problem are:
Let \( \pi()\) denote the mathematical likelihood function and \( x \) denote a vector of parameters. The likelihood function object stores the routine that computes \( \pi(x) \) and whatever data necessary by such routine. The routine in the likelihood function object can compute either the actual value \( \pi(x) \) or the value \( \ln[\pi(x)] \). See files 'basic/inc/ScalarFunction.h' and 'stats/inc/JointPdf.h' for more details.
The output entity of a statistical inverse problem is the posterior RV, another instance of class 'BaseVectorRV<P_V,P_M>', which stores the solution according to the Bayesian approach. Upon return from a solution operation, the posterior RV is available through the operation 'postRv()'. Such posterior RV is able to provide:
Definition at line 85 of file StatisticalInverseProblem.h.
QUESO::StatisticalInverseProblem< P_V, P_M >::StatisticalInverseProblem | ( | const char * | prefix, |
const SipOptionsValues * | alternativeOptionsValues, | ||
const BaseVectorRV< P_V, P_M > & | priorRv, | ||
const BaseScalarFunction< P_V, P_M > & | likelihoodFunction, | ||
GenericVectorRV< P_V, P_M > & | postRv | ||
) |
Constructor.
Requirements:
If alternativeOptionsValues
is NULL and an input file is specified, the constructor reads input options that begin with the string '<prefix>ip_'.
If alternativeOptionsValues
is not NULL, the input file is ignored and construction copies the object pointed to by alternativeOptionsValues
to and stores the copy internally. Users may delete the object poined to by alternativeOptionsValues
. Users cannot change the options object after StatisticalInverseProblem has been constructed.
prefix | The prefix |
alternativeOptionsValues | Options (if no input file) |
priorRv | The prior RV |
likelihoodFunction | The likelihood function |
postRv | The posterior RV |
Definition at line 37 of file StatisticalInverseProblem.C.
References QUESO::queso_require_equal_to_msg, and QUESO::BaseEnvironment::subDisplayFile().
QUESO::StatisticalInverseProblem< P_V, P_M >::StatisticalInverseProblem | ( | const char * | prefix, |
const SipOptionsValues * | alternativeOptionsValues, | ||
const GPMSAFactory< P_V, P_M > & | gpmsaFactory, | ||
GenericVectorRV< P_V, P_M > & | postRv | ||
) |
Constructor for statistical inverse problems to be sovled using GPMSA.
Requirements:
postRv
(obtainable via GaussianProcessFactory::prior method) should be equal to the full prior image set (including all the hyperparameters)If alternativeOptionsValues
is NULL and an input file is specified, the constructor reads input options that begin with the string '<prefix>ip_'.
If alternativeOptionsValues
is not NULL, the input file is ignored and construction copies the object pointed to by alternativeOptionsValues
to and stores the copy internally. Users may delete the object poined to by alternativeOptionsValues
. Users cannot change the options object after StatisticalInverseProblem has been constructed.
Definition at line 106 of file StatisticalInverseProblem.C.
References QUESO::VectorSpace< V, M >::dimLocal(), QUESO::BaseScalarFunction< V, M >::domainSet(), QUESO::BaseVectorRV< V, M >::imageSet(), QUESO::StatisticalInverseProblem< P_V, P_M >::m_env, QUESO::StatisticalInverseProblem< P_V, P_M >::m_likelihoodFunction, QUESO::StatisticalInverseProblem< P_V, P_M >::m_optionsObj, QUESO::StatisticalInverseProblem< P_V, P_M >::m_priorRv, QUESO::BaseEnvironment::optionsInputFileName(), QUESO::queso_require_equal_to_msg, QUESO::BaseEnvironment::subDisplayFile(), and QUESO::VectorSet< V, M >::vectorSpace().
QUESO::StatisticalInverseProblem< P_V, P_M >::~StatisticalInverseProblem | ( | ) |
const BaseVectorSequence< P_V, P_M > & QUESO::StatisticalInverseProblem< P_V, P_M >::chain | ( | ) | const |
Returns the MCMC chain; access to private attribute m_chain.
Only valid after solve has been called.
Definition at line 465 of file StatisticalInverseProblem.C.
bool QUESO::StatisticalInverseProblem< P_V, P_M >::computeSolutionFlag | ( | ) | const |
Whether or not compute the solution.
double QUESO::StatisticalInverseProblem< P_V, P_M >::eig | ( | ) | const |
Definition at line 502 of file StatisticalInverseProblem.C.
double QUESO::StatisticalInverseProblem< P_V, P_M >::logEvidence | ( | ) | const |
Returns the logarithm value of the evidence. Related to ML.
Definition at line 488 of file StatisticalInverseProblem.C.
const ScalarSequence< double > & QUESO::StatisticalInverseProblem< P_V, P_M >::logLikelihoodValues | ( | ) | const |
Returns log likelihood values; access to private attribute m_logLikelihoodValues.
Only valid for MH and only after solve has been called.
Definition at line 473 of file StatisticalInverseProblem.C.
const ScalarSequence< double > & QUESO::StatisticalInverseProblem< P_V, P_M >::logTargetValues | ( | ) | const |
Returns log target values; access to private attribute m_logTargetValues.
Only valid for MH and only after solve has been called.
Definition at line 481 of file StatisticalInverseProblem.C.
double QUESO::StatisticalInverseProblem< P_V, P_M >::meanLogLikelihood | ( | ) | const |
Returns the mean of the logarithm value of the likelihood. Related to ML.
Definition at line 495 of file StatisticalInverseProblem.C.
const GenericVectorRV< P_V, P_M > & QUESO::StatisticalInverseProblem< P_V, P_M >::postRv | ( | ) | const |
Returns the Posterior RV; access to private attribute m_postrRv.
The Posterior RV contains the solution of the Bayes problem.
Definition at line 458 of file StatisticalInverseProblem.C.
void QUESO::StatisticalInverseProblem< P_V, P_M >::print | ( | std::ostream & | os | ) | const |
TODO: Prints the sequence.
Definition at line 510 of file StatisticalInverseProblem.C.
const BaseVectorRV< P_V, P_M > & QUESO::StatisticalInverseProblem< P_V, P_M >::priorRv | ( | ) | const |
Returns the Prior RV; access to private attribute m_priorRv.
Definition at line 451 of file StatisticalInverseProblem.C.
void QUESO::StatisticalInverseProblem< P_V, P_M >::seedWithMAPEstimator | ( | ) |
Seeds the chain with the result of a deterministic optimisation.
This only works for Metropolis-Hastings right now. Multi-level is not currently supported.
Definition at line 373 of file StatisticalInverseProblem.C.
const MetropolisHastingsSG< P_V, P_M > & QUESO::StatisticalInverseProblem< P_V, P_M >::sequenceGenerator | ( | ) | const |
Return the underlying MetropolisHastingSG object.
Definition at line 443 of file StatisticalInverseProblem.C.
void QUESO::StatisticalInverseProblem< P_V, P_M >::solveWithBayesMetropolisHastings | ( | const MhOptionsValues * | alternativeOptionsValues, |
const P_V & | initialValues, | ||
const P_M * | initialProposalCovMatrix | ||
) |
Solves the problem via Bayes formula and a Metropolis-Hastings algorithm.
Requirements:
If the requirements are satisfied, this methods checks the member flag 'm_computeSolution' (one of the options read from the input file during construction). If the flag is 'false', the operation returns immediately, computing nothing; otherwise, the operation sets the member variable 'm_postRv' accordingly. The operation:
If seedWithMapEstimator()
is called before this method, then initialValues
is used as the initial condition for an optimization procedure, the result of which will be used as the seed for the chain.
Definition at line 175 of file StatisticalInverseProblem.C.
References QUESO::InstantiateIntersection(), QUESO::GslOptimizer::minimize(), QUESO::GslOptimizer::minimizer(), QUESO::queso_require_equal_to_msg, QUESO::OptimizerMonitor::set_display_output(), and QUESO::GslOptimizer::setInitialPoint().
void QUESO::StatisticalInverseProblem< P_V, P_M >::solveWithBayesMetropolisHastings | ( | const MhOptionsValues * | alternativeOptionsValues, |
const P_V & | initialValues | ||
) |
Solves the problem via Bayes formula and a Metropolis-Hastings algorithm.
This calls solveWithBayesMetropolisHastings(const MhOptionsValues *, const P_V &, P_M *); with the prior variance as the proposal covariance matrix in the third argument.
Definition at line 338 of file StatisticalInverseProblem.C.
void QUESO::StatisticalInverseProblem< P_V, P_M >::solveWithBayesMetropolisHastings | ( | const MhOptionsValues * | alternativeOptionsValues | ) |
Solves the problem via Bayes formula and a Metropolis-Hastings algorithm.
This calls solveWithBayesMetropolisHastings(const MhOptionsValues *, const P_V &); with the prior mean as the initial point in the second argument.
Definition at line 353 of file StatisticalInverseProblem.C.
void QUESO::StatisticalInverseProblem< P_V, P_M >::solveWithBayesMetropolisHastings | ( | ) |
Solves the problem via Bayes formula and a Metropolis-Hastings algorithm.
This calls solveWithBayesMetropolisHastings(const MhOptionsValues *); with NULL as the options object. Options are read from the input file.
Definition at line 366 of file StatisticalInverseProblem.C.
void QUESO::StatisticalInverseProblem< P_V, P_M >::solveWithBayesMLSampling | ( | ) |
Solves with Bayes Multi-Level (ML) sampling.
Definition at line 380 of file StatisticalInverseProblem.C.
References QUESO::InstantiateIntersection().
|
friend |
Definition at line 251 of file StatisticalInverseProblem.h.
|
private |
Definition at line 272 of file StatisticalInverseProblem.h.
|
private |
Definition at line 258 of file StatisticalInverseProblem.h.
Referenced by QUESO::StatisticalInverseProblem< P_V, P_M >::StatisticalInverseProblem().
|
private |
Definition at line 261 of file StatisticalInverseProblem.h.
Referenced by QUESO::StatisticalInverseProblem< P_V, P_M >::StatisticalInverseProblem().
|
private |
Definition at line 273 of file StatisticalInverseProblem.h.
|
private |
Definition at line 274 of file StatisticalInverseProblem.h.
|
private |
Definition at line 270 of file StatisticalInverseProblem.h.
|
private |
Definition at line 271 of file StatisticalInverseProblem.h.
|
private |
Definition at line 276 of file StatisticalInverseProblem.h.
Referenced by QUESO::StatisticalInverseProblem< P_V, P_M >::StatisticalInverseProblem().
|
private |
Definition at line 262 of file StatisticalInverseProblem.h.
|
private |
Definition at line 260 of file StatisticalInverseProblem.h.
Referenced by QUESO::StatisticalInverseProblem< P_V, P_M >::StatisticalInverseProblem().
|
private |
Definition at line 278 of file StatisticalInverseProblem.h.
|
private |
Definition at line 264 of file StatisticalInverseProblem.h.
|
private |
Definition at line 265 of file StatisticalInverseProblem.h.
|
private |
Definition at line 268 of file StatisticalInverseProblem.h.
|
private |
Definition at line 281 of file StatisticalInverseProblem.h.
|
private |
Definition at line 282 of file StatisticalInverseProblem.h.
|
private |
Definition at line 267 of file StatisticalInverseProblem.h.
|
private |
Definition at line 266 of file StatisticalInverseProblem.h.