Thesis docs
Loading...
Searching...
No Matches
launcher.cpp File Reference

Main launcher file for MCMC simulation with various Bayesian non-parametric processes. More...

#include "samplers/neal.hpp"
#include "samplers/splitmerge.hpp"
#include "samplers/splitmerge_SAMS.hpp"
#include "processes/DP.hpp"
#include "processes/DPW.hpp"
#include "processes/NGGP.hpp"
#include "processes/NGGPW.hpp"
#include "utils/Data.hpp"
#include "utils/Likelihood.hpp"
#include "utils/Params.hpp"
#include "utils/Process.hpp"
#include <chrono>

Functions

 RCPP_MODULE (params_module)
 Rcpp module to expose the Params class to R.
 
Rcpp::List mcmc (const Eigen::MatrixXd &distances, Params &param, const Rcpp::IntegerVector &initial_allocations_r=Rcpp::IntegerVector())
 Main MCMC function for Bayesian non-parametric clustering.
 

Detailed Description

Main launcher file for MCMC simulation with various Bayesian non-parametric processes.

Author
Filippo Galli
Date
2025

This file contains the main MCMC implementation and R interface for running Bayesian non-parametric clustering using different processes (DP, DPW, NGGP, NGGPW) with various sampling strategies (Neal3, Split-Merge, Split-Merge SAMS).

Function Documentation

◆ mcmc()

Rcpp::List mcmc ( const Eigen::MatrixXd & distances,
Params & param,
const Rcpp::IntegerVector & initial_allocations_r = Rcpp::IntegerVector() )

Main MCMC function for Bayesian non-parametric clustering.

This function performs Markov Chain Monte Carlo (MCMC) sampling for clustering analysis using various Bayesian non-parametric processes. It supports different process types (DP, DPW, NGGP, NGGPW) and sampling algorithms (Neal3, Split-Merge).

Parameters
distancesA matrix of distances between data points (Eigen::MatrixXd)
paramReference to a Params object containing all MCMC parameters and hyperparameters
initial_allocations_rOptional initial cluster allocations (Rcpp::IntegerVector). If empty, random initialization will be used.
Returns
Rcpp::List containing:
  • allocations: List of cluster allocations for each iteration
  • K: List of number of clusters for each iteration
  • loglikelihood: Vector of log-likelihood values for each iteration
  • U: Vector of process-specific parameter U for each iteration

The function:

  1. Initializes data structures and likelihood computation
  2. Sets up the chosen Bayesian non-parametric process (currently NGGPW)
  3. Configures the sampling algorithm (currently Split-Merge)
  4. Runs MCMC for burn-in + sampling iterations
  5. Updates process parameters and saves results at each iteration
  6. Provides progress output and timing information
Note
The process type and sampler can be changed by uncommenting/commenting the appropriate lines in the function body.

◆ RCPP_MODULE()

RCPP_MODULE ( params_module )

Rcpp module to expose the Params class to R.

This module creates an R interface for the Params class, allowing R users to create and manipulate parameter objects for the MCMC simulation. The module exposes constructors and all parameter fields with their descriptions.