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

Sequential Allocation Merge-Split (SAMS) sampler for Bayesian nonparametric models. More...

#include <splitmerge_SAMS.hpp>

Inheritance diagram for SplitMerge_SAMS:
Sampler

Public Member Functions

 SplitMerge_SAMS (Data &d, Params &p, Likelihood &l, Process &pr, bool shuffle)
 Constructor for SAMS (Sequential Allocation Merge-Split) sampler.
 
void step () override
 Perform one iteration of the SAMS 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

Sequential Allocation Merge-Split (SAMS) sampler for Bayesian nonparametric models.

This class implements the SAMS algorithm, a variant of the split-merge sampler that uses sequential allocation instead of restricted Gibbs sampling for proposal generation. SAMS can be more efficient than standard split-merge for certain model configurations and provides an alternative proposal mechanism.

Key differences from standard Split-Merge:

  • Sequential Allocation: Observations are allocated one by one in random order
  • Simplified Proposals: No need for full restricted Gibbs chains
  • Efficient Computation: Faster proposal generation for large clusters
  • Maintained Ergodicity: Preserves theoretical properties of split-merge

The algorithm maintains the same three types of moves (split, merge, shuffle) but uses a different mechanism for generating proposals within each move type.

@reference Dahl, D. B. and Newcomb, S. (2022). "Sequentially allocated merge-split samplers for conjugate Bayesian nonparametric models" @reference Martinez, A. F. and Mena, R. H. (2014). "On a Nonparametric Change Point Detection Model in Markovian Regimes"

See also
Sampler, SplitMerge

Constructor & Destructor Documentation

◆ SplitMerge_SAMS()

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

Constructor for SAMS (Sequential Allocation Merge-Split) 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 SAMS sampler, which uses sequential allocation instead of restricted Gibbs sampling for generating proposals. This can provide computational advantages for certain model configurations.

Member Function Documentation

◆ get_accepted_merge()

int SplitMerge_SAMS::get_accepted_merge ( ) const
inline

Get number of accepted merge moves for diagnostics.

Returns
Count of accepted merge moves

◆ get_accepted_shuffle()

int SplitMerge_SAMS::get_accepted_shuffle ( ) const
inline

Get number of accepted shuffle moves for diagnostics.

Returns
Count of accepted shuffle moves

◆ get_accepted_split()

int SplitMerge_SAMS::get_accepted_split ( ) const
inline

Get number of accepted split moves for diagnostics.

Returns
Count of accepted split moves

◆ step()

void SplitMerge_SAMS::step ( )
overridevirtual

Perform one iteration of the SAMS algorithm.

Executes one step of the SAMS sampler:

  1. Randomly select two observations as anchors
  2. Determine move type based on their current assignments
  3. Generate proposal using sequential allocation
  4. Compute acceptance ratio and accept/reject the proposal

The sequential allocation approach can be more efficient than restricted Gibbs sampling while maintaining the theoretical properties of split-merge.

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: