|
Docs
|
Abstract base class for MCMC sampler implementations. More...
#include <Sampler.hpp>
Public Member Functions | |
| Sampler (Data &d, const Likelihood &l, Process &pr) | |
| Constructor initializing sampler with required components. | |
| virtual void | step ()=0 |
| Pure virtual method to perform one MCMC sampling step. | |
| virtual | ~Sampler ()=default |
| Virtual destructor for proper cleanup of derived classes. | |
Protected Attributes | |
| Data & | data |
| Reference to the data object containing observations and current allocations. | |
| const Likelihood & | likelihood |
| Reference to the likelihood computation object for evaluating cluster assignments. | |
| Process & | process |
| Reference to the stochastic process object (DP, NGGP, DPW, NGGPW). | |
| std::random_device | rd |
| Random device for generating random numbers across sampling algorithms. | |
Abstract base class for MCMC sampler implementations.
This class provides the foundation for implementing different MCMC sampling algorithms for Bayesian nonparametric models including Dirichlet Process (DP), Normalized Generalized Gamma Process (NGGP), and their weighted variants (DPW, NGGPW). It holds references to all necessary components and provides a unified interface for different sampling strategies.
The class supports various MCMC algorithms through derived implementations:
Each sampler operates on the same core components but implements different strategies for exploring the posterior distribution of cluster assignments. The composition pattern allows flexible combinations of different data types, likelihood models, process priors, and parameter configurations.
|
inline |
Constructor initializing sampler with required components.
| d | Reference to Data object containing observations and current cluster assignments |
| l | Reference to Likelihood object for evaluating assignment probabilities |
| pr | Reference to Process object (DP, NGGP, DPW, or NGGPW) defining the prior |
The constructor establishes references to all components needed for MCMC sampling. The specific behavior depends on the concrete implementations of each component:
|
virtualdefault |
Virtual destructor for proper cleanup of derived classes.
|
pure virtual |
Pure virtual method to perform one MCMC sampling step.
This method must be implemented by derived classes to define their specific sampling algorithm. Each call should update the current state of the Markov chain by sampling from the appropriate conditional distributions.
Different sampler implementations use different strategies:
The method should update cluster assignments in the Data object and may also update auxiliary variables or hyperparameters as needed by the specific algorithm.
Implemented in Neal3, Neal3ZDNAM, SplitMerge, SplitMerge_LSS, SplitMerge_LSS_SDDS, and SplitMerge_SAMS.
|
protected |
Reference to the data object containing observations and current allocations.
|
protected |
Reference to the likelihood computation object for evaluating cluster assignments.
|
protected |
|
protected |
Random device for generating random numbers across sampling algorithms.