Docs
Loading...
Searching...
No Matches
NGGP.hpp
Go to the documentation of this file.
1
6
7#pragma once
8
10#include "../utils/Process.hpp"
11
22class NGGP : public Process {
23
24protected:
29
40
45
47 std::random_device rd;
48
50 mutable std::mt19937 gen;
51
53
54public:
65 : Process(d, p), gen(rd()), U_sampler_method(mh) {};
66
71
84 [[nodiscard]] double
85 gibbs_prior_existing_cluster(int cls_idx, int obs_idx = 0) const override;
86
96 [[nodiscard]] Eigen::VectorXd
97 gibbs_prior_existing_clusters(int obs_idx) const override;
98
108 [[nodiscard]] double gibbs_prior_new_cluster() const override;
109
111
116
127 [[nodiscard]] double prior_ratio_split(int ci, int cj) const override;
128
139 [[nodiscard]] double prior_ratio_merge(int size_old_ci,
140 int size_old_cj) const override;
141
154 [[nodiscard]] double prior_ratio_shuffle(int size_old_ci, int size_old_cj,
155 int ci, int cj) const override;
156
158
163
173 void update_params() override { U_sampler_method.update_U(); };
174
176};
Abstract interface for Bayesian nonparametric processes.
Base class for sampling the latent variable U in NGGP mixture models.
Manages distance matrices and cluster allocations for points.
Definition Data.hpp:27
std::mt19937 gen
Mersenne Twister random number generator.
Definition NGGP.hpp:50
U_sampler & U_sampler_method
Reference to the U_sampler instance for updating the latent variable U.
Definition NGGP.hpp:38
double prior_ratio_split(int ci, int cj) const override
Computes the prior ratio for a split operation in an NGGP-based split-merge MCMC algorithm.
Definition NGGP.cpp:72
double gibbs_prior_new_cluster() const override
Computes the log prior probability of assigning a data point to a new cluster.
Definition NGGP.cpp:59
void update_params() override
Updates the NGGP parameters by updating the latent variable U.
Definition NGGP.hpp:173
NGGP(Data &d, Params &p, U_sampler &mh)
Constructor for the Normalized Generalized Gamma Process.
Definition NGGP.hpp:64
double prior_ratio_merge(int size_old_ci, int size_old_cj) const override
Computes the prior ratio for a merge operation in an NGGP-based split-merge MCMC algorithm.
Definition NGGP.cpp:97
double gibbs_prior_existing_cluster(int cls_idx, int obs_idx=0) const override
Computes the log prior probability of assigning a data point to an existing cluster.
Definition NGGP.cpp:16
double prior_ratio_shuffle(int size_old_ci, int size_old_cj, int ci, int cj) const override
Computes the prior ratio for a shuffle operation in an NGGP-based split-merge MCMC algorithm.
Definition NGGP.cpp:120
Eigen::VectorXd gibbs_prior_existing_clusters(int obs_idx) const override
Computes the log prior probabilities of assigning a data point to every existing cluster....
Definition NGGP.cpp:34
std::random_device rd
Random device for seeding.
Definition NGGP.hpp:47
Process(Data &d, const Params &p)
Constructor initializing process with data and parameters.
Definition Process.hpp:91
Abstract base class for MCMC sampling of the latent variable U.
Definition U_sampler.hpp:28
Structure containing all parameters needed for the NGGP (Normalized Generalized Gamma Process) and DP...
Definition Params.hpp:35