noparama
v0.0.1
Nonparametric Bayesian models
|
#include <np_update_clusters.h>
Public Member Functions | |
UpdateClusters (random_engine_t &generator, distribution_t &likelihood, distribution_t &nonparametrics) | |
void | update (membertrix &cluster_matrix, int number_mh_steps) |
Protected Member Functions | |
Suffies * | propose () |
This class UpdateClusters only adjusts clusters. This in contrast with UpdateClusterPopulation which also deletes and removes clusters and does not leave the number of clusters invariant.
UpdateClusters::UpdateClusters | ( | random_engine_t & | generator, |
distribution_t & | likelihood, | ||
distribution_t & | nonparametrics | ||
) |
Constructor for the UpdateCluster class.
The class needs access to (1) the likelihood of cluster parameters given observations and (2) the nonparametric prior (e.g. the parameters of a Dirichlet Process).
Mathematical, this class needs access to the likelihood:
And it should be possible to sample parameters from the nonparametric prior:
The cluster parameters are summarized through theta, the hyper parameters are summarized through lambda.
[in] | likelihood | Likelihood function to be used in update() |
[in] | nonparametrics | Sufficient statistics of the nonparametric prior (e.g. Dirichlet) |
Initiate update cluster class and set likelihood and posterior predictive.
|
protected |
void UpdateClusters::update | ( | membertrix & | cluster_matrix, |
int | number_mh_steps | ||
) |
Update all cluster parameters. The number of clusters will not change.
The constructor already sets the relevant (parameters of) probability distributions. The input for this function are only the current cluster parameters and some parameters for the update procedure such as the number of steps.
[in,out] | clusters | Cluster parameters that will be updated |
[in] | number_mh_steps | Number of Metropolis Hastings steps |
Update cluster parameters. This function should leave the number of clusters invariant. The membership matrix should not be different after the function has been executed. There are not more, not less clusters. Only the parameters of the clusters are updated. The update of the parameters uses the data by shifting the prior towards the likelihood, but does not perform maximum likelihood. In this way ergodicity of the chain is maintained and it evolves to the right target distribution.
The parameters of a cluster is called "suffies". This does not mean that the algorithm uses conjugacy, only that there is a limited set of parameters that are sufficient to describe the probability density function.