Thesis docs
|
Implementation of Neal's Algorithm 3 for collapsed Gibbs sampling. More...
#include <neal.hpp>
Public Member Functions | |
Neal3 (Data &d, Params &p, Likelihood &l, Process &pr) | |
Constructor for Neal's Algorithm 3 sampler. | |
void | step () override |
Perform one complete iteration of Neal's Algorithm 3. | |
![]() | |
Sampler (Data &d, Params &p, Likelihood &l, Process &pr) | |
Constructor initializing sampler with required components. | |
virtual | ~Sampler ()=default |
Virtual destructor for proper cleanup of derived classes. | |
Additional Inherited Members | |
![]() | |
Data & | data |
Reference to the data object containing observations and current allocations. | |
Params & | params |
Reference to the parameters object containing model hyperparameters and MCMC settings. | |
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. | |
Implementation of Neal's Algorithm 3 for collapsed Gibbs sampling.
This class implements Neal's Algorithm 3, a standard collapsed Gibbs sampler for Bayesian nonparametric mixture models. The algorithm sequentially updates cluster assignments by sampling from the full conditional distribution of each observation, integrating out the cluster parameters.
Algorithm 3 is characterized by:
The algorithm is particularly effective for models where the likelihood can be computed in closed form after integrating out cluster-specific parameters.
@reference Neal, R. M. (2000). "Markov Chain Sampling Methods for Dirichlet Process Mixture Models"
|
inline |
Constructor for Neal's Algorithm 3 sampler.
d | Reference to Data object containing observations |
p | Reference to Params object with hyperparameters |
l | Reference to Likelihood object for probability computations |
pr | Reference to Process object (DP, NGGP, etc.) defining the prior |
Initializes the Gibbs sampler with all required components. The random number generator is seeded from the inherited random device.
|
overridevirtual |
Perform one complete iteration of Neal's Algorithm 3.
Executes one full sweep of the collapsed Gibbs sampler by sequentially updating the cluster assignment of each observation. The order of updates is typically randomized to avoid systematic bias.
After each full sweep:
Performs a single step of the DP Neal 2 algorithm for all the dataset.
Implements Sampler.