|
| Process (Data &d, Params &p) |
| Constructor initializing process with data and parameters.
|
|
virtual double | gibbs_prior_existing_cluster (int cls_idx, int obs_idx) const =0 |
| Compute prior probability for assigning observation to existing cluster.
|
|
virtual Eigen::VectorXd | gibbs_prior_existing_clusters (int obs_idx) const =0 |
| Compute prior probabilities for assigning observation to all existing clusters.
|
|
virtual double | gibbs_prior_new_cluster () const =0 |
| Compute prior probability for creating a new cluster.
|
|
virtual double | prior_ratio_split (int ci, int cj) const =0 |
| Compute prior ratio for split move in split-merge algorithm.
|
|
virtual double | prior_ratio_merge (int size_old_ci, int size_old_cj) const =0 |
| Compute prior ratio for merge move in split-merge algorithm.
|
|
virtual double | prior_ratio_shuffle (int size_old_ci, int size_old_cj, int ci, int cj) const =0 |
| Compute prior ratio for shuffle move in split-merge algorithm.
|
|
void | set_old_allocations (const Eigen::VectorXi &new_allocations) |
| Store current allocations for potential rollback.
|
|
void | set_idx_i (int i) |
| Set index of first observation in split-merge pair.
|
|
void | set_idx_j (int j) |
| Set index of second observation in split-merge pair.
|
|
virtual void | update_params ()=0 |
| Update process parameters during MCMC sampling.
|
|
virtual | ~Process () |
| Virtual destructor for proper cleanup of derived classes.
|
|
Abstract base class for Bayesian nonparametric processes.
This class provides the foundation for implementing different types of Bayesian nonparametric processes including Dirichlet Process (DP), Normalized Generalized Gamma Process (NGGP), and their weighted variants (DPW, NGGPW). It defines the interface for prior computations needed in both Gibbs sampling and split-merge MCMC algorithms.
The class handles:
- Prior probability computations for existing and new clusters
- Prior ratio calculations for split-merge moves
- Parameter updates during MCMC sampling
- State management for split-merge algorithms
Derived classes must implement the pure virtual methods to define their specific process characteristics (DP, NGGP, NGGPW, DPW).
- See also
- DP, NGGP, NGGPW, DPW
virtual double Process::gibbs_prior_existing_cluster |
( |
int | cls_idx, |
|
|
int | obs_idx ) const |
|
pure virtual |
Compute prior probability for assigning observation to existing cluster.
- Parameters
-
cls_idx | Index of the existing cluster |
obs_idx | Index of the observation to be assigned |
- Returns
- Log prior probability of assignment to existing cluster
This method computes the prior component of the probability for assigning an observation to an existing cluster in Gibbs sampling. The exact computation depends on the specific process (DP, NGGP, etc.).
Implemented in DP, DPW, NGGP, and NGGPW.
virtual Eigen::VectorXd Process::gibbs_prior_existing_clusters |
( |
int | obs_idx | ) |
const |
|
pure virtual |
Compute prior probabilities for assigning observation to all existing clusters.
- Parameters
-
obs_idx | Index of the observation to be assigned |
- Returns
- Vector of log prior probabilities for all existing clusters
This method computes the prior components of the probabilities for assigning an observation to each existing cluster in Gibbs sampling. The exact computation depends on the specific process (DP, NGGP, etc.). The returned vector has a length equal to the current number of clusters.
Implemented in DP, DPW, NGGP, and NGGPW.
virtual double Process::gibbs_prior_new_cluster |
( |
| ) |
const |
|
pure virtual |
Compute prior probability for creating a new cluster.
- Returns
- Log prior probability of creating a new cluster
This method computes the prior probability of assigning an observation to a new cluster in Gibbs sampling. The computation is process-specific.
Implemented in DP, DPW, NGGP, and NGGPW.
virtual double Process::prior_ratio_merge |
( |
int | size_old_ci, |
|
|
int | size_old_cj ) const |
|
pure virtual |
Compute prior ratio for merge move in split-merge algorithm.
- Parameters
-
size_old_ci | Size of first cluster before merge |
size_old_cj | Size of second cluster before merge |
- Returns
- Log prior ratio for the merge move
Computes the ratio of prior probabilities when merging two clusters into one cluster. Used in the acceptance probability of merge moves.
Implemented in DP, DPW, NGGP, and NGGPW.
virtual double Process::prior_ratio_shuffle |
( |
int | size_old_ci, |
|
|
int | size_old_cj, |
|
|
int | ci, |
|
|
int | cj ) const |
|
pure virtual |
Compute prior ratio for shuffle move in split-merge algorithm.
- Parameters
-
size_old_ci | Size of first cluster before shuffle |
size_old_cj | Size of second cluster before shuffle |
ci | Index of first cluster after shuffle |
cj | Index of second cluster after shuffle |
- Returns
- Log prior ratio for the shuffle move
Computes the ratio of prior probabilities when redistributing observations between two existing clusters. Used in restricted Gibbs sampling.
Implemented in DP, DPW, NGGP, and NGGPW.
virtual double Process::prior_ratio_split |
( |
int | ci, |
|
|
int | cj ) const |
|
pure virtual |
Compute prior ratio for split move in split-merge algorithm.
- Parameters
-
ci | Index of first resulting cluster after split |
cj | Index of second resulting cluster after split |
- Returns
- Log prior ratio for the split move
Computes the ratio of prior probabilities when splitting a cluster into two clusters. Used in the acceptance probability of split moves.
Implemented in DP, DPW, NGGP, and NGGPW.
virtual void Process::update_params |
( |
| ) |
|
|
pure virtual |
Update process parameters during MCMC sampling.
This method allows derived classes to update their specific parameters during the MCMC chain. For example, some processes may need to sample hyperparameters or update auxiliary variables. Implementation is process-specific.
Implemented in DP, DPW, NGGP, and NGGPW.