lppl  v0.13.0
GenericMetropolis< I, O, V, Q, Ts > Struct Template Reference

Generic Metropolis-Hastings algorithm with user-specified proposal distribution. More...

#include "base.hpp"

Inheritance diagram for GenericMetropolis< I, O, V, Q, Ts >:
Inference< GenericMetropolis, I, O, V, Q, Ts... >

Public Member Functions

operator() (I &input, pp_t< record_t< Ts... >, double, Ts... > &proposal)
 Runs the inference algorithm. More...
 
void step (MetropolisState< Ts... > &state, pp_t< I, O, Ts... > &f, Q< V, O, Ts... > &queryer, pp_t< record_t< Ts... >, double, Ts... > &proposal, pp_t< record_t< Ts... >, double, Ts... > &replayed_proposal, I input, inf_options_t opts)
 
- Public Member Functions inherited from Inference< GenericMetropolis, I, O, V, Q, Ts... >
 Inference (pp_t< I, O, Ts... > f, Q< V, O, Ts... > &queryer, inf_options_t opts)
 
std::enable_if_t< has_proposal< G >::value==kernel::none, V > operator() (I &input)
 Runs the specified inference algorithm with the specified queryer. More...
 
std::enable_if_t< has_proposal< G >::value==kernel::full, V > operator() (I &input, P &proposal)
 Runs the specified inference algorithm with the specified queryer using the specified proposal distribution. More...
 
std::enable_if_t< has_proposal< G >::value==kernel::partial, V > operator() (I &input, pp_t< record_t< Ts... >, double, Ts... > &proposal)
 Runs the specified inference algorithm with the specified queryer using the specified proposal distribution. More...
 

Additional Inherited Members

- Public Attributes inherited from Inference< GenericMetropolis, I, O, V, Q, Ts... >
pp_t< I, O, Ts... > f
 
inf_options_t opts
 
Q< V, O, Ts... > & queryer
 

Detailed Description

template<typename I, typename O, typename V, template< class, class, class... > class Q, typename... Ts>
struct GenericMetropolis< I, O, V, Q, Ts >

Generic Metropolis-Hastings algorithm with user-specified proposal distribution.

Suppose the probabilistic program factors as \(p(x, z) = p(x|z)p(z)\) and the proposal distribution takes the form \(q(z'|z)\). The log acceptance ratio is computed as \( \log \alpha = [\log p(x, z') - \log q(z' | z)] - [\log p(x, z) - \log q(z | z')]\), where \(z' \sim q(z'|z)\) are the newly generated unobserved rvs. The proposal distribution need not be symmetric.

Template Parameters
IThe input type of the probabilistic program
OThe output type of the probabilistic program
VThe type of the value to be queried
QThe queryer class template
TsThe types of the distributions in the probabilistic program

The documentation for this struct was generated from the following file: