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

Split-Merge sampler for Bayesian nonparametric mixture models. More...

#include <splitmerge.hpp>

Inheritance diagram for SplitMerge:
Sampler

Public Member Functions

 SplitMerge (Data &d, Params &p, Likelihood &l, Process &pr, bool shuffle)
 Constructor for Split-Merge sampler.
 
void step () override
 Perform one iteration of the split-merge algorithm.
 
int get_accepted_split () const
 Get number of accepted split moves for diagnostics.
 
int get_accepted_merge () const
 Get number of accepted merge moves for diagnostics.
 
int get_accepted_shuffle () const
 Get number of accepted shuffle moves for diagnostics.
 
- 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

Split-Merge sampler for Bayesian nonparametric mixture models.

This class implements the split-merge algorithm, an advanced MCMC method that proposes joint updates to cluster assignments through split and merge moves. This approach can achieve better mixing than sequential Gibbs sampling, particularly for models with strong within-cluster correlations.

The algorithm alternates between three types of moves:

  • Split moves: Divide a cluster into two subclusters
  • Merge moves: Combine two clusters into one
  • Shuffle moves: Redistribute observations between two existing clusters

Each move uses restricted Gibbs sampling to generate proposals, followed by Metropolis-Hastings acceptance/rejection based on prior and likelihood ratios. The algorithm maintains detailed balance and ergodicity.

@reference Jain, S. and Neal, R. M. (2004). "A Split-Merge Markov Chain Monte Carlo Procedure for the Dirichlet Process Mixture Model" @reference Martinez, A. F. and Mena, R. H. (2014). "On a Nonparametric Change Point Detection Model in Markovian Regimes"

See also
Sampler, SplitMerge_SAMS

Constructor & Destructor Documentation

◆ SplitMerge()

SplitMerge::SplitMerge ( Data & d,
Params & p,
Likelihood & l,
Process & pr,
bool shuffle )
inline

Constructor for Split-Merge 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 defining the prior
shuffleFlag to enable shuffle moves in addition to split-merge

Initializes the split-merge sampler with the option to include shuffle moves. When shuffle is enabled, the algorithm can propose redistributions between existing clusters in addition to split-merge moves.

Member Function Documentation

◆ get_accepted_merge()

int SplitMerge::get_accepted_merge ( ) const
inline

Get number of accepted merge moves for diagnostics.

Returns
Count of accepted merge moves

◆ get_accepted_shuffle()

int SplitMerge::get_accepted_shuffle ( ) const
inline

Get number of accepted shuffle moves for diagnostics.

Returns
Count of accepted shuffle moves

◆ get_accepted_split()

int SplitMerge::get_accepted_split ( ) const
inline

Get number of accepted split moves for diagnostics.

Returns
Count of accepted split moves

◆ step()

void SplitMerge::step ( )
overridevirtual

Perform one iteration of the split-merge algorithm.

Executes one step of the split-merge sampler:

  1. Randomly select two observations
  2. Determine move type based on current cluster assignments
  3. Generate proposal via restricted Gibbs sampling
  4. Compute acceptance ratio and accept/reject via Metropolis-Hastings

The algorithm automatically chooses between split, merge, and shuffle moves based on the cluster assignments of the selected observations.

Perform a single split-merge MCMC step. Randomly choose two indices and decide whether to propose a split or merge move.

Implements Sampler.


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