noparama  v0.0.1
Nonparametric Bayesian models
Public Member Functions | Protected Member Functions | List of all members
UpdateClusters Class Reference

#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

Suffiespropose ()
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ UpdateClusters()

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:

  • L(theta|x0,...xN)

And it should be possible to sample parameters from the nonparametric prior:

  • theta ~ p(theta|lambda)

The cluster parameters are summarized through theta, the hyper parameters are summarized through lambda.

Parameters
[in]likelihoodLikelihood function to be used in update()
[in]nonparametricsSufficient statistics of the nonparametric prior (e.g. Dirichlet)

Initiate update cluster class and set likelihood and posterior predictive.

Member Function Documentation

◆ propose()

Suffies * UpdateClusters::propose ( )
protected

◆ update()

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.

Parameters
[in,out]clustersCluster parameters that will be updated
[in]number_mh_stepsNumber 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.


The documentation for this class was generated from the following files: