An implemental of the Adaptive Metropolis algorithm. More...
#include <AMProposal.h>
An implemental of the Adaptive Metropolis algorithm.
Configuration Parameters:
Parameter Key | Type | Default Value | Description |
---|---|---|---|
"ProposalVariance" | Double | 1.0 | Initial proposal variance before adaptation begins. |
"AdaptSteps" | Integer | - | How often the proposal covariance should be updated. |
"AdaptStart" | Integer | - | How many steps should be taken before beginning to adapt the covariance. |
"AdaptScale" | Double | - | Scaling of the sample covariance used to define the proposal covariance: \(\Sigma_{prop} = \alpha \hat{\Sigma}\) |
Definition at line 21 of file AMProposal.h.
Public Member Functions | |
AMProposal (boost::property_tree::ptree pt, std::shared_ptr< AbstractSamplingProblem > const &prob) | |
AMProposal (boost::property_tree::ptree pt, std::shared_ptr< AbstractSamplingProblem > const &prob, Eigen::MatrixXd const &initialCov) | |
virtual | ~AMProposal ()=default |
virtual void | Adapt (unsigned int const t, std::vector< std::shared_ptr< SamplingState >> const &states) override |
Adapt the proposal after each step. More... | |
virtual Eigen::MatrixXd | ProposalCovariance () const |
Public Member Functions inherited from muq::SamplingAlgorithms::MCMCProposal | |
MCMCProposal (boost::property_tree::ptree const &pt, std::shared_ptr< AbstractSamplingProblem > const &probIn) | |
virtual | ~MCMCProposal ()=default |
void | SetCommunicator (std::shared_ptr< parcer::Communicator > newcomm) |
virtual void | SetBlockInd (int newBlockInd) |
virtual int | GetBlockInd () const |
Additional Inherited Members | |
Public Types inherited from muq::SamplingAlgorithms::MCMCProposal | |
typedef std::function< std::shared_ptr< MCMCProposal >boost::property_tree::ptree, std::shared_ptr< AbstractSamplingProblem >)> | MCMCProposalConstructor |
typedef std::map< std::string, MCMCProposalConstructor > | MCMCProposalMap |
Static Public Member Functions inherited from muq::SamplingAlgorithms::MCMCProposal | |
static std::shared_ptr< MCMCProposal > | Construct (boost::property_tree::ptree const &pt, std::shared_ptr< AbstractSamplingProblem > const &probIn) |
Static constructor for the transition kernel. More... | |
static std::shared_ptr< MCMCProposalMap > | GetMCMCProposalMap () |
muq::SamplingAlgorithms::AMProposal::AMProposal | ( | boost::property_tree::ptree | pt, |
std::shared_ptr< AbstractSamplingProblem > const & | prob | ||
) |
muq::SamplingAlgorithms::AMProposal::AMProposal | ( | boost::property_tree::ptree | pt, |
std::shared_ptr< AbstractSamplingProblem > const & | prob, | ||
Eigen::MatrixXd const & | initialCov | ||
) |
Construct the adaptive Metropolis proposal with a specific estimate of the target covariance matrix. Note that initailCov will be scaled by the adaptScale parameter set in the ptree and should therefore be an estiamte of the target covariance, not a specification of the proposal covariance.
|
virtualdefault |
|
overridevirtual |
Adapt the proposal after each step.
Adapt the proposal covariance.
[in] | t | The current step |
[in] | state | The current state |
Reimplemented from muq::SamplingAlgorithms::MCMCProposal.
Reimplemented in muq::SamplingAlgorithms::ParallelAMProposal.
Definition at line 43 of file AMProposal.cpp.
References adaptEnd, adaptStart, adaptSteps, muq::SamplingAlgorithms::MCMCProposal::blockInd, mean, newSamps, numAdaptSamps, numNewSamps, and propChol.
Referenced by muq::SamplingAlgorithms::ParallelAMProposal::Adapt().
|
staticprivate |
Definition at line 34 of file AMProposal.cpp.
References muq::SamplingAlgorithms::MCMCProposal::prob.
|
overrideprivatevirtual |
Implements muq::SamplingAlgorithms::MCMCProposal.
Definition at line 97 of file AMProposal.cpp.
References adaptScale, muq::SamplingAlgorithms::MCMCProposal::blockInd, numAdaptSamps, and propChol.
|
virtual |
Returns the current proposal covariance.
Definition at line 79 of file AMProposal.cpp.
References adaptScale, numAdaptSamps, and propChol.
|
overrideprivatevirtual |
Implements muq::SamplingAlgorithms::MCMCProposal.
Definition at line 84 of file AMProposal.cpp.
References adaptScale, muq::SamplingAlgorithms::MCMCProposal::blockInd, numAdaptSamps, and propChol.
|
private |
After how many iterations should we stop adapting?
Definition at line 85 of file AMProposal.h.
Referenced by Adapt().
|
private |
Definition at line 88 of file AMProposal.h.
Referenced by LogDensity(), ProposalCovariance(), and Sample().
|
private |
|
private |
How frequently should we update the adaption?
Definition at line 79 of file AMProposal.h.
Referenced by Adapt().
|
private |
|
private |
|
private |
Total number of samples that have been used so far to compute mean and covariance.
Definition at line 67 of file AMProposal.h.
Referenced by Adapt(), LogDensity(), ProposalCovariance(), and Sample().
|
private |
Definition at line 64 of file AMProposal.h.
Referenced by Adapt().
|
private |
The Cholesky factorization of the current proposal covariance.
Definition at line 76 of file AMProposal.h.
Referenced by Adapt(), LogDensity(), ProposalCovariance(), and Sample().
|
private |
The current proposal covariance.
Definition at line 73 of file AMProposal.h.