|
| Params & | params |
| | Reference to the parameters object containing NGGP parameters.
|
| Data & | data |
| | Reference to the data object containing observations and cluster assignments.
|
| int | total_iterations = 0 |
| | Counter for total MCMC iterations performed.
|
| int | accepted_U = 0 |
| | Counter of accepted U.
|
| std::random_device | rd |
| | Random device for seeding.
|
| std::mt19937 | gen |
| | Mersenne Twister random number generator.
|
Pre-computed values for computational efficiency.
|
| const double | a_over_sigma = params.a / params.sigma |
| | Ratio a/sigma for efficient computation.
|
| const double | tau_power_sigma = std::pow(params.tau, params.sigma) |
| | Pre-computed tau^sigma for efficient computation.
|
| const int | n = data.get_n() |
| | Number of observations n.
|
| double | U = 1.0 |
| | Current value of the latent variable U (initialized to 1.0).
|
Abstract base class for MCMC sampling of the latent variable U.
This class provides the interface and common functionality for sampling the latent variable U in Normalized Generalized Gamma Process (NGGP) mixture models. The latent variable U appears in the conditional distribution of the partition and must be updated via MCMC methods.
Derived classes must implement the update_U() method using specific sampling algorithms such as Random Walk Metropolis-Hastings (RWMH) or Metropolis-Adjusted Langevin Algorithm (MALA).
- Note
- Reference: "Clustering blood donors via mixtures of product partition
models with covariates" by Argiento et al., 2024
| double U_sampler::log_conditional_density_V |
( |
double | v | ) |
const |
|
protected |
Computes the log conditional density of V = log(U) given the partition.
This method evaluates the unnormalized log conditional density of the transformed latent variable V = log(U) given the current partition π. The transformation uses the change-of-variables formula:
Taking the logarithm:
This transformed density is useful for MCMC sampling on the log scale, which can improve numerical stability and sampling efficiency.
- Parameters
-
| v | The value of V = log(U) at which to evaluate the density. |
- Returns
- The log of the unnormalized conditional density of V.
- See also
- log_conditional_density_U()
| virtual void U_sampler::update_U |
( |
| ) |
|
|
pure virtual |
Pure virtual method to update the latent variable U.
This method must be implemented by derived classes to perform MCMC updates of the latent variable U using specific sampling algorithms (e.g., Random Walk Metropolis-Hastings, MALA).
Implemented in MALA, and RWMH.