compute_optimal_clustering: Compute the optimal clustering from an MCMC sample

View source: R/posterior_clustering_analysis.R

compute_optimal_clusteringR Documentation

Compute the optimal clustering from an MCMC sample

Description

Summarizes the posterior on all possible clusterings by an optimal clustering where optimality is defined as minimizing the posterior expectation of a specific loss function. Supports GreedyEPL and SALSO.

Usage

compute_optimal_clustering(fit, method = "GreedyEPL", loss_type = "VI")

Arguments

fit

The fitted object, obtained from one of the MixNRMIx functions

method

The method to use for optimal clustering. Can be "GreedyEPL" or "SALSO". Defaults to "GreedyEPL".

loss_type

Defines the loss function to be used in the expected posterior loss minimization. Only used if method is "GreedyEPL". Can be one of "VI", "B", "NVI", or "NID". Defaults to "VI".

Value

A vector of integers with the same size as the data, indicating the allocation of each data point.

Examples

## Not run: 
data(acidity)
x <- acidity
# Fitting the model under default specifications
out <- MixNRMI1(x)
compute_optimal_clustering(out)

## End(Not run)

BNPdensity documentation built on Aug. 8, 2025, 7:20 p.m.