# Pivotal Methods for Bayesian Relabelling and k-Means Clustering

Collection of pivotal algorithms for: relabelling the MCMC chains in order to undo the label switching problem in Bayesian mixture models, as proposed in Egidi, Pappadà, Pauli and Torelli (2018a); initializing the centers of the classical k-means algorithm in order to obtain a better clustering solution. For further details see Egidi, Pappadà, Pauli and Torelli (2018b).

The goal of pivmet is to propose some pivotal methods in order to:

• undo the label switching problem which naturally arises during the MCMC sampling in Bayesian mixture models (\rightarrow) pivotal relabelling (Egidi et al. 2018a)

• initialize the K-means algorithm aimed at obtaining a good clustering solution (\rightarrow) pivotal seeding (Egidi et al. 2018b)

## Installation

You can then install pivmet from github with:

## Example 1. Dealing with label switching: relabelling in Bayesian mixture models by pivotal units (fish data)

First of all, we load the package and we import the fish dataset belonging to the bayesmix package:

Then we fit a Bayesian Gaussian mixture using the piv_MCMC function:

Finally, we can apply pivotal relabelling and inspect the new posterior estimates with the functions piv_rel and piv_plot, respectively:

## Example 2. K-means clustering using MUS and other pivotal algorithms

Sometimes K-means algorithm does not provide an optimal clustering solution. Suppose to generate some clustered data and to detect one pivotal unit for each group with the MUS (Maxima Units Search algorithm) function:

Quite often, classical K-means fails in recognizing the true groups:

In such situations, we may need a more robust version of the classical K-means. The pivots may be used as initial seeds for a classical K-means algorithm. The function piv_KMeans works as the classical kmeans function, with some optional arguments (in the figure below, the colored triangles represent the pivots).

## References

Egidi, L., Pappadà, R., Pauli, F. and Torelli, N. (2018a). Relabelling in Bayesian Mixture Models by Pivotal Units. Statistics and Computing, 28(4), 957-969.

Egidi, L., Pappadà, R., Pauli, F., Torelli, N. (2018b). K-means seeding via MUS algorithm. Conference Paper, Book of Short Papers, SIS2018, ISBN: 9788891910233.

# pivmet 0.1.1

• Fix duplicate entries of the vignette source
• Include references in the description field.

# pivmet 0.1.0

• First submission to CRAN.

# Reference manual

install.packages("pivmet")

0.3.0 by Leonardo Egidi, 10 months ago

https://github.com/leoegidi/pivmet

Browse source code at https://github.com/cran/pivmet

Authors: Leonardo Egidi[aut, cre] , Roberta Pappadà[aut] , Francesco Pauli[aut] , Nicola Torelli[aut]

Documentation:   PDF Manual