Thesis docs
Loading...
Searching...
No Matches
Neal3 Class Reference

Implementation of Neal's Algorithm 3 for collapsed Gibbs sampling. More...

#include <neal.hpp>

Inheritance diagram for Neal3:
Sampler

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.
 
- Public Member Functions inherited from Sampler
 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

- Protected Attributes inherited from Sampler
Datadata
 Reference to the data object containing observations and current allocations.
 
Paramsparams
 Reference to the parameters object containing model hyperparameters and MCMC settings.
 
Likelihoodlikelihood
 Reference to the likelihood computation object for evaluating cluster assignments.
 
Processprocess
 Reference to the stochastic process object (DP, NGGP, DPW, NGGPW)
 
std::random_device rd
 Random device for generating random numbers across sampling algorithms.
 

Detailed Description

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:

  • Sequential updates: One observation at a time
  • Collapsed sampling: Cluster parameters are integrated out analytically
  • Full conditionals: Each assignment is sampled from its exact posterior
  • Automatic cluster creation/deletion: Clusters are created when needed and deleted when empty

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"

See also
Sampler, Process, Likelihood

Constructor & Destructor Documentation

◆ Neal3()

Neal3::Neal3 ( Data & d,
Params & p,
Likelihood & l,
Process & pr )
inline

Constructor for Neal's Algorithm 3 sampler.

Parameters
dReference to Data object containing observations
pReference to Params object with hyperparameters
lReference to Likelihood object for probability computations
prReference 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.

Member Function Documentation

◆ step()

void Neal3::step ( )
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:

  • All observations have been considered for reassignment
  • Cluster structure may have changed (clusters created/destroyed)
  • The Markov chain has advanced by one step
See also
step_1_observation()

Performs a single step of the DP Neal 2 algorithm for all the dataset.

Implements Sampler.


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