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

#include <np_mcmc.h>

Public Member Functions

 MCMC (std::default_random_engine &generator, InitClusters &init_clusters, UpdateClusters &update_clusters, UpdateClusterPopulation &update_cluster_population, int subset_count, distribution_t &likelihood)
 
void run (dataset_t &dataset, int T)
 
const membertrix & getMembershipMatrix () const
 
const membertrix & getMaxLikelihoodMatrix () const
 

Protected Member Functions

void considerMaxLikelihood ()
 

Detailed Description

The MCMC class can be equiped with InitCluster, UpdateCluster, and UpdateClusterPopulation objects that each will be used in a Monte-Carlo Monte Chain algorithm. This algorithm is run for T steps and returns a membership matrix in the form of a membertrix object.

Constructor & Destructor Documentation

◆ MCMC()

MCMC::MCMC ( std::default_random_engine &  generator,
InitClusters &  init_clusters,
UpdateClusters &  update_clusters,
UpdateClusterPopulation &  update_cluster_population,
int  subset_count,
distribution_t &  likelihood 
)

Constructor for MCMC.

Parameters
[in]generatorA random number generator
[in]init_clustersAn object that initializes clusters
[in]update_clustersAn object that updates the cluster parameters
[in]update_cluster_populationAn object that generates and removes clusters

Member Function Documentation

◆ considerMaxLikelihood()

void MCMC::considerMaxLikelihood ( )
protected

Calculate maximum likelihood of current assignments

[out] _max_likelihood_membertrix The max likelihood membership matrix up to now [out] _max_likelihood The max likelihood up to now

◆ getMaxLikelihoodMatrix()

const membertrix & MCMC::getMaxLikelihoodMatrix ( ) const

◆ getMembershipMatrix()

const membertrix & MCMC::getMembershipMatrix ( ) const

The results of the MCMC algorithm is a membership matrix.

Returns
The membership matrix (const)

◆ run()

void MCMC::run ( dataset_t &  dataset,
int  T 
)

Run the MCMC method (can be one or multiple chains) for T steps.

Parameters
[in]datasetThe dataset to run the MCMC on
[in]TThe number of steps

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