Proximity Measure Based Diagnostics for Standard, Soft, and Multi-Way Clustering

Quantifies clustering quality by measuring both cohesion within clusters and separation between clusters. Silhouette widths are computed from the n by K matrices that clustering algorithms return (distances or similarities to cluster prototypes, fuzzy memberships, or posterior probabilities) instead of all pairwise dissimilarities, for the partition an algorithm produced or one supplied by the user. Implements the simplified silhouette of Van der Laan et al. (2003) , the probability of alternative cluster normalization of Raymaekers and Rousseeuw (2022) , the fuzzy silhouette average of Campello and Hruschka (2006) , the density-based silhouette of Menardi (2011) , the soft silhouettes of Bhat Kapu and Kiruthika (2024) , and the extended silhouette for multi-way clustering of Schepers et al. (2008) and Bhat Kapu and Kiruthika (2025) . Provides summaries and 'ggplot2' silhouette plots in the style of Rousseeuw (1987) .


Silhouette Silhouette website

CRAN Status (ago)codecov

GitHub R-CMD-check pages-build-deployment

An R package for silhouette-based diagnostics in standard, soft, and multi-way clustering.

Quantifies clustering quality by measuring both cohesion within clusters and separation between clusters. Implements advanced silhouette width computations for diverse clustering structures, including: simplified silhouette by Van der Laan et al. (2003), Probability of Alternative Cluster normalization methods by Raymaekers & Rousseeuw (2022), fuzzy clustering and silhouette diagnostics using membership probabilities by Campello & Hruschka (2006), Menardi (2011) and Bhat & Kiruthika (2024), and multi-way clustering extensions such as block and tensor clustering by Schepers et al. (2008) and Bhat & Kiruthika (2025). Provides tools for computation and visualization based on Rousseeuw (1987) to support robust and reproducible cluster diagnostics across standard, soft, and multi-way clustering settings.

Note: This package does not use the classical Rousseeuw (1987) calculation directly.


✅ Why This Package?

  • Unified & consistent: Offers one coherent interface for crisp, soft, and multi-way clustering silhouette diagnostics.
  • Flexible: Works with distance matrices, clustering outputs, or soft membership probabilities.
  • Advanced: Implements newer normalization methods (PAC, db), handles soft clustering, and supports mode-wise silhouette aggregation.
  • Visualization: Plot functions produce clear, customizable silhouette plots compatible with many clustering outputs and existing silhouette outputs from factoextra, cluster and drclust R packages.
  • Comparability: Summaries and plots make it easy to compare clustering algorithms or tune the number of clusters.
  • Interoperable: All Silhouette class functions work with any clustering output that provides a proximity or membership probability matrix. Users can also supply a proximity matrix and a clustering function—including S3 or S4 methods—to let Silhouette class perform clustering and compute silhouettes internally in one step.

Installation

You can install the released version of Silhouette from GitHub using:

# Install devtools if needed
if (!requireNamespace("devtools", quietly = TRUE)) {
  install.packages("devtools")
}

# Install from GitHub
devtools::install_github("kskbhat/Silhouette")

From CRAN, install via:

install.packages("Silhouette")

Usage

library(Silhouette)
km <- kmeans(iris[, 1:4], centers = 3, nstart = 20)
sil <- Silhouette(proxy::dist(iris[, 1:4], km$centers))  # n x K distances
summary(sil)
plot(sil)

The package has four vignettes:

The package website has three further articles: silhouette plots for results from this and other packages, a case study comparing soft clusterings of thyroid patients, and a comparison with other packages, including timings.


Report a Bug or Request a Feature

If you encounter a bug or have an idea for a new feature in the Silhouette package, please let us know by opening an issue on GitHub:

  • Create an issue on GitHub
  • For bugs: include a minimal reproducible example, describe the expected vs. actual behavior, and mention your R and package versions
  • For feature requests: clearly describe the proposed feature, its purpose, and how it would benefit users

Your feedback and suggestions are valuable and help improve the package.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("Silhouette")

0.9.7 by Shrikrishna Bhat K, 11 days ago


https://kskbhat.github.io/Silhouette/


Report a bug at https://github.com/kskbhat/Silhouette/issues


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


Authors: Shrikrishna Bhat K [aut, cre, cph] (ORCID: , Kiruthika C [aut]


Documentation:   PDF Manual  


GPL-2 license


Imports ggplot2, ggpubr, methods, stats, utils

Suggests proxy, ppclust, cluster, factoextra, drclust, mclust, knitr, lifecycle, rmarkdown, spelling, testthat


See at CRAN