MUQ  0.4.3
muq::SamplingAlgorithms::InferenceProblem Class Reference

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>

Inheritance diagram for muq::SamplingAlgorithms::InferenceProblem:

Detailed Description

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< SamplingStateQOI () 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< AbstractSamplingProblemClone () 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
 

Constructor & Destructor Documentation

◆ InferenceProblem() [1/2]

InferenceProblem::InferenceProblem ( std::shared_ptr< muq::Modeling::ModPiece > const &  likelyIn,
std::shared_ptr< muq::Modeling::ModPiece > const &  priorIn,
double  inverseTempIn = 1.0 
)
Parameters
[in]likelyInA ModPiece that evaluates the log-likelihood function, which will be multiplied by the inverse temperature
[in]priorInA ModPiece that evaluates the log-prior density. The number and sizes of the prior inputs must match the likelihood.
[in]inverseTempInThe inverse temperature \(\beta\) that scales the likelihood function.

Definition at line 7 of file InferenceProblem.cpp.

◆ InferenceProblem() [2/2]

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 
)
Parameters
[in]likelyInA ModPiece that evaluates the log-likelihood function, which will be multiplied by the inverse temperature
[in]priorInA ModPiece that evaluates the log-prior density. The number and sizes of the prior inputs must match the likelihood.
[in]qoiQuantity of interest associated with model
[in]inverseTempInThe inverse temperature \(\beta\) that scales the likelihood function.

Definition at line 14 of file InferenceProblem.cpp.

◆ ~InferenceProblem()

virtual muq::SamplingAlgorithms::InferenceProblem::~InferenceProblem ( )
virtualdefault

Member Function Documentation

◆ Clone()

std::shared_ptr< AbstractSamplingProblem > InferenceProblem::Clone ( ) const
overridevirtual

Reimplemented from muq::SamplingAlgorithms::AbstractSamplingProblem.

Definition at line 56 of file InferenceProblem.cpp.

References inverseTemp, likely, prior, and qoi.

◆ GetInverseTemp()

double muq::SamplingAlgorithms::InferenceProblem::GetInverseTemp ( ) const
inline

Get the inverse temperature of this problem.

Definition at line 65 of file InferenceProblem.h.

References inverseTemp.

◆ GradLogDensity()

Eigen::VectorXd InferenceProblem::GradLogDensity ( std::shared_ptr< SamplingState > const &  state,
unsigned const  blockWrt 
)
overridevirtual

Default finite difference gradient implementation.

Reimplemented from muq::SamplingAlgorithms::AbstractSamplingProblem.

Definition at line 46 of file InferenceProblem.cpp.

References inverseTemp, likely, and prior.

◆ Likelihood()

std::shared_ptr<muq::Modeling::ModPiece> const& muq::SamplingAlgorithms::InferenceProblem::Likelihood ( ) const
inline

Definition at line 58 of file InferenceProblem.h.

References likely.

◆ LogDensity()

double InferenceProblem::LogDensity ( std::shared_ptr< SamplingState > const &  state)
overridevirtual

◆ Prior()

std::shared_ptr<muq::Modeling::ModPiece> const& muq::SamplingAlgorithms::InferenceProblem::Prior ( ) const
inline

Definition at line 59 of file InferenceProblem.h.

References prior.

◆ QOI()

std::shared_ptr< SamplingState > InferenceProblem::QOI ( )
overridevirtual

Reimplemented from muq::SamplingAlgorithms::AbstractSamplingProblem.

Definition at line 38 of file InferenceProblem.cpp.

References lastState, and qoi.

◆ SetInverseTemp()

void muq::SamplingAlgorithms::InferenceProblem::SetInverseTemp ( double  newTemp)
inline

Set the inverse temperature of this problem.

Definition at line 62 of file InferenceProblem.h.

References inverseTemp.

Member Data Documentation

◆ inverseTemp

double muq::SamplingAlgorithms::InferenceProblem::inverseTemp
protected

Definition at line 79 of file InferenceProblem.h.

Referenced by Clone(), GetInverseTemp(), GradLogDensity(), LogDensity(), and SetInverseTemp().

◆ lastState

std::shared_ptr<SamplingState> muq::SamplingAlgorithms::InferenceProblem::lastState
private

Definition at line 83 of file InferenceProblem.h.

Referenced by LogDensity(), and QOI().

◆ likely

std::shared_ptr<muq::Modeling::ModPiece> muq::SamplingAlgorithms::InferenceProblem::likely
protected

The log-likelihood function.

Definition at line 72 of file InferenceProblem.h.

Referenced by Clone(), GradLogDensity(), Likelihood(), and LogDensity().

◆ prior

std::shared_ptr<muq::Modeling::ModPiece> muq::SamplingAlgorithms::InferenceProblem::prior
protected

The prior log-density.

Definition at line 75 of file InferenceProblem.h.

Referenced by Clone(), GradLogDensity(), LogDensity(), and Prior().

◆ qoi

std::shared_ptr<muq::Modeling::ModPiece> muq::SamplingAlgorithms::InferenceProblem::qoi
protected

Definition at line 77 of file InferenceProblem.h.

Referenced by Clone(), and QOI().


The documentation for this class was generated from the following files: