MUQ  0.4.3
muq::SamplingAlgorithms::ExpensiveSamplingProblem Class Reference

#include <ExpensiveSamplingProblem.h>

Inheritance diagram for muq::SamplingAlgorithms::ExpensiveSamplingProblem:

Detailed Description

Definition at line 16 of file ExpensiveSamplingProblem.h.

Public Member Functions

 ExpensiveSamplingProblem (std::shared_ptr< muq::Modeling::ModPiece > const &target, std::shared_ptr< muq::Modeling::ModPiece > const &qoi, Eigen::VectorXd const &centroid, boost::property_tree::ptree pt)
 
 ExpensiveSamplingProblem (std::shared_ptr< muq::Modeling::ModPiece > const &target, std::shared_ptr< muq::Modeling::ModPiece > const &qoi, boost::property_tree::ptree pt)
 
 ExpensiveSamplingProblem (std::shared_ptr< muq::Modeling::ModPiece > const &target, boost::property_tree::ptree pt)
 
 ExpensiveSamplingProblem (std::shared_ptr< muq::Modeling::ModPiece > const &target, Eigen::VectorXd const &centroid, boost::property_tree::ptree pt)
 
 ExpensiveSamplingProblem (std::shared_ptr< muq::Modeling::ModPiece > const &target, boost::property_tree::ptree pt, std::shared_ptr< parcer::Communicator > comm)
 
 ExpensiveSamplingProblem (std::shared_ptr< muq::Modeling::ModPiece > const &target, Eigen::VectorXd const &centroid, boost::property_tree::ptree pt, std::shared_ptr< parcer::Communicator > comm)
 
virtual ~ExpensiveSamplingProblem ()=default
 
virtual double LogDensity (std::shared_ptr< SamplingState > const &state) override
 
unsigned int CacheSize () const
 
virtual void AddOptions (boost::property_tree::ptree &pt) const override
 
virtual std::shared_ptr< SamplingStateQOI () override
 
- Public Member Functions inherited from muq::SamplingAlgorithms::SamplingProblem
 SamplingProblem (std::shared_ptr< muq::Modeling::ModPiece > const &targetIn)
 
 SamplingProblem (std::shared_ptr< muq::Modeling::ModPiece > const &targetIn, std::shared_ptr< muq::Modeling::ModPiece > const &qoiIn)
 
virtual ~SamplingProblem ()=default
 
virtual std::shared_ptr< AbstractSamplingProblemClone () const override
 
virtual Eigen::VectorXd GradLogDensity (std::shared_ptr< SamplingState > const &state, unsigned const blockWrt) override
 
std::shared_ptr< muq::Modeling::ModPieceGetDistribution ()
 
- 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
 

Public Attributes

unsigned int cumbeta = 0
 Cumulative beta refinements. More...
 
unsigned int cumgamma = 0
 Cumulative gamma refinements. More...
 
unsigned int cumkappa = 0
 Cumulative kappa refinements. More...
 
double lastLyapunov = 0.0
 The Lyapunov function at the most recently accepted point. More...
 
double lastThreshold = 0.0
 The error threshold at the most recently accepted point. More...
 
- Public Attributes inherited from muq::SamplingAlgorithms::AbstractSamplingProblem
const int numBlocks
 
const Eigen::VectorXi blockSizes
 
const int numBlocksQOI
 
const Eigen::VectorXi blockSizesQOI
 

Constructor & Destructor Documentation

◆ ExpensiveSamplingProblem() [1/6]

muq::SamplingAlgorithms::ExpensiveSamplingProblem::ExpensiveSamplingProblem ( std::shared_ptr< muq::Modeling::ModPiece > const &  target,
std::shared_ptr< muq::Modeling::ModPiece > const &  qoi,
Eigen::VectorXd const &  centroid,
boost::property_tree::ptree  pt 
)
Parameters
[in]targetThe target distribution
[in]qoiThe quantity of interest
[in]centroidThe centroid of the distribution
[in]ptOptions for the sampling problem

◆ ExpensiveSamplingProblem() [2/6]

muq::SamplingAlgorithms::ExpensiveSamplingProblem::ExpensiveSamplingProblem ( std::shared_ptr< muq::Modeling::ModPiece > const &  target,
std::shared_ptr< muq::Modeling::ModPiece > const &  qoi,
boost::property_tree::ptree  pt 
)
Parameters
[in]targetThe target distribution
[in]qoiThe quantity of interest
[in]ptOptions for the sampling problem

◆ ExpensiveSamplingProblem() [3/6]

muq::SamplingAlgorithms::ExpensiveSamplingProblem::ExpensiveSamplingProblem ( std::shared_ptr< muq::Modeling::ModPiece > const &  target,
boost::property_tree::ptree  pt 
)
Parameters
[in]targetThe target distribution
[in]ptOptions for the sampling problem

◆ ExpensiveSamplingProblem() [4/6]

muq::SamplingAlgorithms::ExpensiveSamplingProblem::ExpensiveSamplingProblem ( std::shared_ptr< muq::Modeling::ModPiece > const &  target,
Eigen::VectorXd const &  centroid,
boost::property_tree::ptree  pt 
)
Parameters
[in]targetThe target distribution
[in]centroidThe centroid of the distribution
[in]ptOptions for the sampling problem

◆ ExpensiveSamplingProblem() [5/6]

ExpensiveSamplingProblem::ExpensiveSamplingProblem ( std::shared_ptr< muq::Modeling::ModPiece > const &  target,
boost::property_tree::ptree  pt,
std::shared_ptr< parcer::Communicator >  comm 
)
Parameters
[in]targetThe target distribution
[in]ptOptions for the sampling problem
[in]commParallel communicator for regression

Definition at line 55 of file ExpensiveSamplingProblem.cpp.

References reg, SetUp(), and muq::SamplingAlgorithms::SamplingProblem::target.

◆ ExpensiveSamplingProblem() [6/6]

ExpensiveSamplingProblem::ExpensiveSamplingProblem ( std::shared_ptr< muq::Modeling::ModPiece > const &  target,
Eigen::VectorXd const &  centroid,
boost::property_tree::ptree  pt,
std::shared_ptr< parcer::Communicator >  comm 
)
Parameters
[in]targetThe target distribution
[in]centroidThe centroid of the distribution
[in]ptOptions for the sampling problem
[in]commParallel communicator for regression

Definition at line 63 of file ExpensiveSamplingProblem.cpp.

References reg, SetUp(), and muq::SamplingAlgorithms::SamplingProblem::target.

◆ ~ExpensiveSamplingProblem()

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

Member Function Documentation

◆ AddOptions()

void ExpensiveSamplingProblem::AddOptions ( boost::property_tree::ptree &  pt) const
overridevirtual

Sometimes, there will be problem-specific options that need to be passed to the SamplingAlgorithm. This function adds any of those options to the given property_tree.

Reimplemented from muq::SamplingAlgorithms::AbstractSamplingProblem.

Definition at line 241 of file ExpensiveSamplingProblem.cpp.

◆ CacheSize()

unsigned int ExpensiveSamplingProblem::CacheSize ( ) const

Definition at line 239 of file ExpensiveSamplingProblem.cpp.

References reg.

◆ CheckNeighbors()

void ExpensiveSamplingProblem::CheckNeighbors ( std::shared_ptr< SamplingState > const &  state,
std::vector< Eigen::VectorXd > &  neighbors,
std::vector< Eigen::VectorXd > &  results 
) const
private

Check to make sure we have enough model evaluations.

Check to see if the state has the nearest neighbors already stored. If yes, return them, if not, find and return them.

Parameters
[in]stateFind the nearest neighbors closest to this point
[out]neighborsThe nearest neighbors
[out]resultsThe log-target at the nearest neighbors

Definition at line 142 of file ExpensiveSamplingProblem.cpp.

References reg.

Referenced by RefineSurrogate().

◆ CheckNumNeighbors()

void ExpensiveSamplingProblem::CheckNumNeighbors ( std::shared_ptr< SamplingState > const &  state)
private

Check to make sure we have enough model evaluations.

Parameters
[in]stateIf we do not have enough points, sample from a standard Gaussian centered at this point

Definition at line 132 of file ExpensiveSamplingProblem.cpp.

References cumkappa, gamma, reg, and regQoI.

Referenced by RefineSurrogate().

◆ ErrorThreshold()

double ExpensiveSamplingProblem::ErrorThreshold ( Eigen::VectorXd const &  x) const
private

Compute the error threshold.

Parameters
[in]xThe state of the MCMC chain
Returns
The error threshild

Definition at line 150 of file ExpensiveSamplingProblem.cpp.

References gamma, level, and LogLyapunovFunction().

Referenced by RefineSurrogate().

◆ LogDensity()

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

◆ LogLyapunovFunction()

double ExpensiveSamplingProblem::LogLyapunovFunction ( Eigen::VectorXd const &  x) const
private

Estimate the Lyapunov function.

Defaults to \(V(x) = \exp{(\|x-\bar{x}\|_2)}\).

Parameters
[in]xthe input point \(x\)
Returns
\(V(x)\)

Definition at line 128 of file ExpensiveSamplingProblem.cpp.

References centroid, and lyapunovPara.

Referenced by ErrorThreshold(), and LogDensity().

◆ QOI()

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

◆ RefineSurrogate() [1/3]

void ExpensiveSamplingProblem::RefineSurrogate ( Eigen::VectorXd const &  point,
unsigned int const  index,
std::vector< Eigen::VectorXd > &  neighbors,
std::vector< Eigen::VectorXd > &  results 
)
private

Replace the point that is farthest from the new point

Parameters
[in]stateThe point where we are evalauting the log target
[in]indexThe index of the point that we are replacing
[out]neighborsThe nearest neighbors
[out]resultsThe log-target at the nearest neighbors

Definition at line 225 of file ExpensiveSamplingProblem.cpp.

References reg, and regQoI.

◆ RefineSurrogate() [2/3]

double ExpensiveSamplingProblem::RefineSurrogate ( std::shared_ptr< SamplingState > const &  state,
double const  radius,
std::vector< Eigen::VectorXd > &  neighbors,
std::vector< Eigen::VectorXd > &  results 
)
private
Parameters
[in]stateThe state where we are evalauting the log target
[in]radiusThe radus of the nearest neighbor ball
[out]neighborsThe nearest neighbors
[out]resultsThe log-target at the nearest neighbors
Returns
The poisedness constant \(\Lambda\)

Definition at line 154 of file ExpensiveSamplingProblem.cpp.

References RefineSurrogate(), and reg.

◆ RefineSurrogate() [3/3]

double ExpensiveSamplingProblem::RefineSurrogate ( unsigned int const  step,
std::shared_ptr< SamplingState > const &  state,
std::vector< Eigen::VectorXd > &  neighbors,
std::vector< Eigen::VectorXd > &  results 
)
private
Parameters
[in]stepThe current MCMC step
[in]stateThe state where we are evalauting the log target
[out]neighborsThe nearest neighbors
[out]resultsThe log-target at the nearest neighbors
Returns
The error threshold

Definition at line 188 of file ExpensiveSamplingProblem.cpp.

References beta, CheckNeighbors(), CheckNumNeighbors(), cumbeta, cumgamma, ErrorThreshold(), gamma, level, reg, step, and tau0.

Referenced by LogDensity(), and RefineSurrogate().

◆ SetUp()

void ExpensiveSamplingProblem::SetUp ( boost::property_tree::ptree &  pt)
private

Set up the sampling problem.

Parameters
[in]ptOptions for the sampling problem

Definition at line 72 of file ExpensiveSamplingProblem.cpp.

References beta, eta, gamma, lyapunovPara, reg, muq::SamplingAlgorithms::SamplingProblem::target, and tau0.

Referenced by ExpensiveSamplingProblem().

Member Data Documentation

◆ beta

std::pair<double, double> muq::SamplingAlgorithms::ExpensiveSamplingProblem::beta
private

Parameters for random refinement.

Refine with probability \(\beta = \beta_0 t^{-\beta_1}\). \(\beta_0\) is "BetaScale" and it defaults to \(0\). \(\beta_1\) is "BetaExponent" and it defaults to \(RAND_MAX\).

Definition at line 165 of file ExpensiveSamplingProblem.h.

Referenced by LogDensity(), RefineSurrogate(), and SetUp().

◆ centroid

const Eigen::VectorXd muq::SamplingAlgorithms::ExpensiveSamplingProblem::centroid
private

The centroid of the distribution (input parameter)

Definition at line 183 of file ExpensiveSamplingProblem.h.

Referenced by LogLyapunovFunction().

◆ cumbeta

unsigned int muq::SamplingAlgorithms::ExpensiveSamplingProblem::cumbeta = 0

Cumulative beta refinements.

Definition at line 195 of file ExpensiveSamplingProblem.h.

Referenced by LogDensity(), and RefineSurrogate().

◆ cumgamma

unsigned int muq::SamplingAlgorithms::ExpensiveSamplingProblem::cumgamma = 0

Cumulative gamma refinements.

Definition at line 198 of file ExpensiveSamplingProblem.h.

Referenced by LogDensity(), and RefineSurrogate().

◆ cumkappa

unsigned int muq::SamplingAlgorithms::ExpensiveSamplingProblem::cumkappa = 0

Cumulative kappa refinements.

Definition at line 201 of file ExpensiveSamplingProblem.h.

Referenced by CheckNumNeighbors().

◆ eta

double muq::SamplingAlgorithms::ExpensiveSamplingProblem::eta
private

Tail correction parameter.

Definition at line 186 of file ExpensiveSamplingProblem.h.

Referenced by LogDensity(), and SetUp().

◆ gamma

std::pair<double, double> muq::SamplingAlgorithms::ExpensiveSamplingProblem::gamma
private

Parameters for structural refinement.

Refine if the error threshold exceeds \(\gamma = \gamma_0 l^{-\gamma_1}\), where \(l\) is the current error threshold level (ExpensiveSamplingProblem::level). \(\gamma_0\) is "GammaScale" and it defaults to \(1\). \(\gamma_1\) is "GammaExponent" and it defaults to \(1.0\).

Definition at line 177 of file ExpensiveSamplingProblem.h.

Referenced by CheckNumNeighbors(), ErrorThreshold(), RefineSurrogate(), and SetUp().

◆ lastLyapunov

double muq::SamplingAlgorithms::ExpensiveSamplingProblem::lastLyapunov = 0.0

The Lyapunov function at the most recently accepted point.

Definition at line 204 of file ExpensiveSamplingProblem.h.

Referenced by LogDensity().

◆ lastThreshold

double muq::SamplingAlgorithms::ExpensiveSamplingProblem::lastThreshold = 0.0

The error threshold at the most recently accepted point.

Definition at line 207 of file ExpensiveSamplingProblem.h.

Referenced by LogDensity().

◆ level

unsigned int muq::SamplingAlgorithms::ExpensiveSamplingProblem::level = 1
private

The current error threshold level.

Definition at line 189 of file ExpensiveSamplingProblem.h.

Referenced by ErrorThreshold(), and RefineSurrogate().

◆ lyapunovPara

std::pair<double, double> muq::SamplingAlgorithms::ExpensiveSamplingProblem::lyapunovPara
private

The scaling and exponent for the Lyapunov function.

Definition at line 180 of file ExpensiveSamplingProblem.h.

Referenced by LogLyapunovFunction(), and SetUp().

◆ reg

std::shared_ptr<muq::Approximation::LocalRegression> muq::SamplingAlgorithms::ExpensiveSamplingProblem::reg
private

The regression for the log-likelihood.

Definition at line 156 of file ExpensiveSamplingProblem.h.

Referenced by CacheSize(), CheckNeighbors(), CheckNumNeighbors(), ExpensiveSamplingProblem(), LogDensity(), RefineSurrogate(), and SetUp().

◆ regQoI

std::shared_ptr<muq::Approximation::LocalRegression> muq::SamplingAlgorithms::ExpensiveSamplingProblem::regQoI
private

The regression for the quantity of interest.

Definition at line 159 of file ExpensiveSamplingProblem.h.

Referenced by CheckNumNeighbors(), QOI(), and RefineSurrogate().

◆ step

unsigned int muq::SamplingAlgorithms::ExpensiveSamplingProblem::step = 0
private

The current step in the MCMC chain.

Definition at line 192 of file ExpensiveSamplingProblem.h.

Referenced by LogDensity(), and RefineSurrogate().

◆ tau0

double muq::SamplingAlgorithms::ExpensiveSamplingProblem::tau0
private

The length of the first level.

\(\tau_0\) is "FirstLevelLength" and defaults to \(1.0\).

Definition at line 171 of file ExpensiveSamplingProblem.h.

Referenced by RefineSurrogate(), and SetUp().


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