Class for sampling problems based on the product of a prior and likelihood, possibly with a tempering applied to the likelihood. More...
#include <InferenceProblem.h>
Class for sampling problems based on the product of a prior and likelihood, possibly with a tempering applied to the likelihood.
This class implements posterior distributions \(\pi(x_1,\ldots,x_N|y)\) over \(N\) vectors \(x_1,\ldots,x_N\). It is defined in terms of a likelihood, \(\pi(y | x_1,\ldots,x_N)\), prior density \(\pi(x)\) and optionally, a parameter \(\beta\) called the "inverse temperature". Together, these quantities define \(\pi(x|y)\) up to a normalizing constant:
\[ \log\pi(x | y) \propto \beta\log\pi(y|x) +\log\pi(x). \]
The inverse temperature \(\beta\) is included to support implementations of parallel tempering algorithms.
Definition at line 25 of file InferenceProblem.h.
Public Member Functions | |
InferenceProblem (std::shared_ptr< muq::Modeling::ModPiece > const &likelyIn, std::shared_ptr< muq::Modeling::ModPiece > const &priorIn, double inverseTempIn=1.0) | |
InferenceProblem (std::shared_ptr< muq::Modeling::ModPiece > const &likelyIn, std::shared_ptr< muq::Modeling::ModPiece > const &priorIn, std::shared_ptr< muq::Modeling::ModPiece > const &qoiIn, double inverseTempIn=1.0) | |
virtual | ~InferenceProblem ()=default |
virtual double | LogDensity (std::shared_ptr< SamplingState > const &state) override |
virtual Eigen::VectorXd | GradLogDensity (std::shared_ptr< SamplingState > const &state, unsigned const blockWrt) override |
virtual std::shared_ptr< SamplingState > | QOI () override |
std::shared_ptr< muq::Modeling::ModPiece > const & | Likelihood () const |
std::shared_ptr< muq::Modeling::ModPiece > const & | Prior () const |
void | SetInverseTemp (double newTemp) |
double | GetInverseTemp () const |
virtual std::shared_ptr< AbstractSamplingProblem > | Clone () const override |
Public Member Functions inherited from muq::SamplingAlgorithms::AbstractSamplingProblem | |
AbstractSamplingProblem (Eigen::VectorXi const &blockSizesIn, Eigen::VectorXi const &blockSizesQOIIn) | |
AbstractSamplingProblem (Eigen::VectorXi const &blockSizesIn) | |
virtual | ~AbstractSamplingProblem ()=default |
virtual void | AddOptions (boost::property_tree::ptree &pt) const |
Additional Inherited Members | |
Public Attributes inherited from muq::SamplingAlgorithms::AbstractSamplingProblem | |
const int | numBlocks |
const Eigen::VectorXi | blockSizes |
const int | numBlocksQOI |
const Eigen::VectorXi | blockSizesQOI |
InferenceProblem::InferenceProblem | ( | std::shared_ptr< muq::Modeling::ModPiece > const & | likelyIn, |
std::shared_ptr< muq::Modeling::ModPiece > const & | priorIn, | ||
double | inverseTempIn = 1.0 |
||
) |
[in] | likelyIn | A ModPiece that evaluates the log-likelihood function, which will be multiplied by the inverse temperature |
[in] | priorIn | A ModPiece that evaluates the log-prior density. The number and sizes of the prior inputs must match the likelihood. |
[in] | inverseTempIn | The inverse temperature \(\beta\) that scales the likelihood function. |
Definition at line 7 of file InferenceProblem.cpp.
InferenceProblem::InferenceProblem | ( | std::shared_ptr< muq::Modeling::ModPiece > const & | likelyIn, |
std::shared_ptr< muq::Modeling::ModPiece > const & | priorIn, | ||
std::shared_ptr< muq::Modeling::ModPiece > const & | qoiIn, | ||
double | inverseTempIn = 1.0 |
||
) |
[in] | likelyIn | A ModPiece that evaluates the log-likelihood function, which will be multiplied by the inverse temperature |
[in] | priorIn | A ModPiece that evaluates the log-prior density. The number and sizes of the prior inputs must match the likelihood. |
[in] | qoi | Quantity of interest associated with model |
[in] | inverseTempIn | The inverse temperature \(\beta\) that scales the likelihood function. |
Definition at line 14 of file InferenceProblem.cpp.
|
virtualdefault |
|
overridevirtual |
Reimplemented from muq::SamplingAlgorithms::AbstractSamplingProblem.
Definition at line 56 of file InferenceProblem.cpp.
References inverseTemp, likely, prior, and qoi.
|
inline |
Get the inverse temperature of this problem.
Definition at line 65 of file InferenceProblem.h.
References inverseTemp.
|
overridevirtual |
Default finite difference gradient implementation.
Reimplemented from muq::SamplingAlgorithms::AbstractSamplingProblem.
Definition at line 46 of file InferenceProblem.cpp.
References inverseTemp, likely, and prior.
|
inline |
Definition at line 58 of file InferenceProblem.h.
References likely.
|
overridevirtual |
Implements muq::SamplingAlgorithms::AbstractSamplingProblem.
Definition at line 24 of file InferenceProblem.cpp.
References inverseTemp, lastState, likely, and prior.
|
inline |
Definition at line 59 of file InferenceProblem.h.
References prior.
|
overridevirtual |
Reimplemented from muq::SamplingAlgorithms::AbstractSamplingProblem.
Definition at line 38 of file InferenceProblem.cpp.
|
inline |
Set the inverse temperature of this problem.
Definition at line 62 of file InferenceProblem.h.
References inverseTemp.
|
protected |
Definition at line 79 of file InferenceProblem.h.
Referenced by Clone(), GetInverseTemp(), GradLogDensity(), LogDensity(), and SetInverseTemp().
|
private |
Definition at line 83 of file InferenceProblem.h.
Referenced by LogDensity(), and QOI().
|
protected |
The log-likelihood function.
Definition at line 72 of file InferenceProblem.h.
Referenced by Clone(), GradLogDensity(), Likelihood(), and LogDensity().
|
protected |
The prior log-density.
Definition at line 75 of file InferenceProblem.h.
Referenced by Clone(), GradLogDensity(), LogDensity(), and Prior().
|
protected |
Definition at line 77 of file InferenceProblem.h.