Locality Sensitive Sampling (LSS) Split-Merge sampler for Bayesian nonparametric models.
More...
|
| 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 | split_move () |
| | Execute a split move using LSS.
|
| double | compute_acceptance_ratio_split (double likelihood_old_cluster) |
| | Compute acceptance ratio for LSS split move.
|
| void | merge_move () |
| | Execute a merge move using LSS.
|
| 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.
|
| Eigen::VectorXi | original_allocations |
| | Original cluster assignments before move proposal.
|
| 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).
|
| int | accepted_split = 0 |
| int | accepted_merge = 0 |
| int | accepted_shuffle = 0 |
Locality Sensitive Sampling (LSS) Split-Merge sampler for Bayesian nonparametric models.
This class implements the LSS Split-Merge algorithm, a variant of the split-merge sampler that uses locality sensitive sampling to select anchor points based on similarity information. LSS can be more efficient than standard split-merge for large datasets by focusing computational effort on similar observations.
Key differences from standard Split-Merge:
- Locality Sensitive Sampling: Anchor points are selected based on similarity/distance
- Sequential Allocation: Observations are allocated one by one in random order
- Efficient Computation: Faster proposal generation leveraging data structure
- 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 sequential allocation for generating proposals within each move type.
- Note
- reference Luo, C., Shrivastava, A. (2018). "Scaling-up Split-Merge MCMC with
Locality Sensitive Sampling (LSS)" 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
| void SplitMerge_LSS::sequential_allocation |
( |
int | iterations, |
|
|
bool | only_probabilities = false, |
|
|
bool | sequential = true ) |
|
private |
Generate proposal state via sequential allocation.
- Parameters
-
| iterations | Number of allocation passes to perform |
| only_probabilities | If true, only compute proposal probabilities without updating state |
| sequential | If true, use sequential allocation; if false, use restricted Gibbs sampling |
Implements the core SAMS algorithm by sequentially allocating observations to clusters. Unlike restricted Gibbs sampling, this approach processes observations one by one in random order, making allocation decisions based on current partial assignments.
Perform restricted Gibbs sampling on the points in S to propose new allocations for iter iterations.
- Parameters
-
| iterations | Number of Gibbs sampling iterations to perform. |
| only_probabilities | If true, only compute the probabilities without |
| sequential | If true, unallocate points before sampling (default true) changing allocations (used in merge move). |
| void SplitMerge_LSS::step |
( |
| ) |
|
|
overridevirtual |
Perform one iteration of the LSS Split-Merge algorithm.
Executes one step of the LSS Split-Merge sampler:
- Select two observations as anchors using locality sensitive sampling
- Determine move type based on their current assignments
- Generate proposal using sequential allocation
- Compute acceptance ratio and accept/reject the proposal
The locality sensitive sampling approach selects similar or dissimilar points based on distance information, while sequential allocation provides efficient proposal generation 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.