|
| | SplitMerge_LSS_SDDS (Data &d, Params &p, Likelihood &l, Process &pr, bool shuffle) |
| | Constructor for LSS-SDDS (Locality Sensitive Sampling with Smart-split, Dumb-merge, Dumb-split, Smart-merge) Split-Merge sampler.
|
| void | step () override final |
| | Perform one iteration of the LSS-SDDS Split-Merge algorithm.
|
| double | get_accepted_split () const |
| | Get number of accepted split moves for diagnostics.
|
| double | get_accepted_merge () const |
| | Get number of accepted merge moves for diagnostics.
|
| double | get_accepted_shuffle () const |
| | Get number of accepted shuffle moves for diagnostics.
|
| | Sampler (Data &d, const Params &p, const Likelihood &l, Process &pr) |
| | Constructor initializing sampler with required components.
|
| virtual | ~Sampler ()=default |
| | Virtual destructor for proper cleanup of derived classes.
|
|
| void | choose_indeces (bool similarity=false) |
| | Randomly select two observations for split-merge proposal.
|
| void | choose_clusters_shuffle () |
| | Select clusters for shuffle move.
|
| void | sequential_allocation (int iterations, bool only_probabilities=false, bool sequential=true) |
| | Generate proposal state via sequential allocation.
|
| void | smart_split_move () |
| | Execute a smart split move using sequential allocation.
|
| void | dumb_split_move () |
| | Execute a dumb split move with random allocation.
|
| double | compute_acceptance_ratio_split (double likelihood_old_cluster) |
| | Compute acceptance ratio for LSS split move.
|
| void | smart_merge_move () |
| | Execute a smart merge move using sequential allocation.
|
| void | dumb_merge_move () |
| | Execute a dumb merge move with direct merging.
|
| double | compute_acceptance_ratio_merge (double likelihood_old_ci, double likelihood_old_cj) |
| | Compute acceptance ratio for LSS merge move.
|
| void | shuffle () |
| | Execute a shuffle move using LSS.
|
| double | compute_acceptance_ratio_shuffle (double likelihood_old_ci, double likelihood_old_cj, int old_ci_size, int old_cj_size) |
| | Compute acceptance ratio for LSS shuffle move.
|
|
| std::mt19937 | gen |
| | Mersenne Twister random number generator for sampling operations.
|
| int | idx_i |
| | Index of first randomly chosen observation.
|
| int | idx_j |
| | Index of second randomly chosen observation.
|
| int | ci |
| | Cluster assignment of first observation.
|
| int | cj |
| | Cluster assignment of second observation.
|
| bool | shuffle_bool = false |
| | Flag to enable shuffle moves (Mena and Martinez, 2014).
|
| Eigen::VectorXi | launch_state |
| | Launch state for sequential allocation.
|
| Eigen::VectorXi | S |
| | Indices of observations in clusters ci and cj.
|
| int | launch_state_size |
| | Size of the launch state and S vectors.
|
| const Eigen::VectorXi & | original_allocations |
| | Cached reference to original allocations stored in the process.
|
| std::uniform_real_distribution | dis_real |
| | uniform distribution between 0 and 1
|
| std::uniform_int_distribution | dis_int |
| | uniform integer distribution for general use
|
| Eigen::Vector2d | log_probs |
| | Log probabilities of allocating a point to clusters ci and cj.
|
| Eigen::Vector2d | probs |
| | Probabilities of allocating a point to clusters ci and cj.
|
| double | log_split_gibbs_prob = 0 |
| | Log probability of generating current state via sequential allocation (split direction).
|
| double | log_merge_gibbs_prob = 0 |
| | Log probability of generating current state via sequential allocation (merge direction).
|
| const double | rand_split_prob = log(0.5) |
| | Constant log probability for random split allocation (dumb split).
|
| int | accepted_split = 0 |
| int | accepted_merge = 0 |
| int | accepted_shuffle = 0 |
| int | split_moves = 0 |
| int | merge_moves = 0 |
| int | shuffle_moves = 0 |
Locality Sensitive Sampling (LSS) with SDDS Split-Merge sampler.
This class implements the LSS Split-Merge algorithm with SDDS (Smart-split, Dumb-merge, Dumb-split, Smart-merge), a variant of the split-merge sampler that uses locality sensitive sampling to select anchor points based on similarity/dissimilarity information. The SDDS strategy adaptively chooses between smart (sequential allocation) and dumb (simple random) proposals to balance computational cost with proposal quality:
- When dissimilar points are selected: Smart split + Dumb merge
- When similar points are selected: Dumb split + Smart merge This improves mixing efficiency while maintaining computational tractability.
Key differences from standard Split-Merge:
- Locality Sensitive Sampling: Anchor points are selected based on similarity/dissimilarity derived from distances
- SDDS Strategy: Adaptive smart/dumb pairing based on point similarity
- Dissimilar points → Smart split (sequential allocation) + Dumb merge (direct)
- Similar points → Dumb split (random) + Smart merge (sequential allocation)
- Sequential Allocation: Used in "smart" moves for intelligent proposal generation
- Efficient Computation: Balances computational cost with mixing quality
- Maintained Ergodicity: Preserves theoretical properties of split-merge
The algorithm maintains the same three types of moves (split, merge, shuffle) but uses locality sensitive sampling for anchor point selection and adaptively applies sequential allocation based on the SDDS strategy.
- Note
- References:
- Luo, C., Shrivastava, A. (2018). "Scaling-up Split-Merge MCMC with
Locality Sensitive Sampling (LSS)"
- Dahl, D. B. and Newcomb, S. (2022). "Sequentially allocated merge-split
samplers for conjugate Bayesian nonparametric models"
- Martinez, A. F. and Mena, R. H. (2014). "On a Nonparametric Change Point
Detection Model in Markovian Regimes"
- See also
- Sampler, SplitMerge
| void SplitMerge_LSS_SDDS::choose_indeces |
( |
bool | similarity = false | ) |
|
|
private |
Randomly select two observations for split-merge proposal.
Samples two distinct observation indices using locality sensitive sampling. When similarity=false, selects dissimilar points (for split moves). When similarity=true, selects similar points (for merge moves). The first point is selected uniformly, and the second is selected based on distance weights from the first point.
- Parameters
-
| similarity | If true, select similar points; if false, select dissimilar points |
| void SplitMerge_LSS_SDDS::step |
( |
| ) |
|
|
finaloverridevirtual |
Perform one iteration of the LSS-SDDS Split-Merge algorithm.
Executes one step of the LSS-SDDS Split-Merge sampler implementing the SDDS strategy (Smart-split, Dumb-merge, Dumb-split, Smart-merge):
- Randomly choose between dissimilarity mode or similarity mode (50/50)
- Select two anchor observations using locality sensitive sampling:
- Dissimilarity mode (move_type=0): select dissimilar points (weighted by 1/distance)
- Similarity mode (move_type=1): select similar points (weighted by distance)
- Determine move type based on current cluster assignments:
- Same cluster (ci == cj): propose split move
- Different clusters (ci != cj): propose merge move
- Execute appropriate move using SDDS pairing:
- Dissimilarity mode: Smart split if ci==cj, Dumb merge if ci!=cj
- Similarity mode: Dumb split if ci==cj, Smart merge if ci!=cj
- Optionally perform shuffle move to improve mixing
- Compute acceptance ratio and accept/reject the proposal
The SDDS strategy balances computational efficiency with proposal quality by using smart (sequential allocation) moves where they matter most and dumb (simple random) moves elsewhere, while maintaining detailed balance.
Implements Sampler.