CluSim: a Python package for the comparison of clusterings and dendrograms

Alexander J. Gates, Yong‐Yeol AhnbioRxiv 2018 · DOI

TL;DR

This paper introduces CluSim, a comprehensive Python package that offers over 20 similarity measures for comparing different types of clusterings, including partitions, overlapping clusters, and hierarchical dendrograms. It addresses the critical need for robust clustering comparison by providing novel element-centric approaches and incorporating methods to account for chance, making it a valuable tool for method evaluation and data analysis.

What Problem Does This Paper Address?

Quantifying how similar two clusterings are is fundamental in many data analysis tasks, such as evaluating clustering algorithms, building consensus clusters, and tracking how clusters evolve over time. However, there's no single, universally agreed-upon way to measure this similarity. Different similarity measures can lead to contradictory conclusions, and scientific communities often stick to their own preferred methods without considering their underlying assumptions. Furthermore, comparing clusterings often requires a baseline to understand if the observed similarity is meaningful or just due to chance. This paper tackles this by providing a unified library of similarity measures and methods to compare clusterings against random models, offering a more standardized and comprehensive approach.

Methods

The core of CluSim is its ability to handle three main types of clusterings:

  • Partitions: Elements are assigned to distinct, non-overlapping groups.
  • Hierarchical Clusterings (Dendrograms): Elements are grouped in a nested, tree-like structure.
  • Overlapping Clusterings: Elements can belong to multiple groups simultaneously.

CluSim offers over 20 similarity measures for these types. A key innovation is the element-centric similarity measure, which provides a unified way to compare all three clustering types. The package also incorporates methods for correction for chance, which is crucial for interpreting similarity scores. This includes analytic solutions for some measures (like the Rand index and Normalized Mutual Information) using various random models, and empirical estimation for others by sampling random clusterings.

Datasets

The paper demonstrates CluSim's utility with two examples:

  1. Gene Expression Data: Used to evaluate Hierarchical Clustering for identifying cancer types. This example compares a ground truth classification against a clustering derived from gene expression data, assessed against different random models.
  2. Phylogenetic Trees (Dendrograms): Used to analyze gene-tree heterogeneity across 424 nuclear genes from 37 eutherian mammals. This showcases the element-centric comparison of dendrograms to identify areas of conflict in evolutionary relationships.

No new benchmarks were introduced; instead, existing datasets were used to showcase the package's capabilities.

Key Insights and Ideas

  • The importance of choosing the right random model: The paper highlights how different random models can drastically alter the interpretation of clustering similarity. What appears better than chance under one model might be worse than chance under a more appropriate model for the specific scenario.
  • Element-centric similarity unifies comparisons: This novel approach provides a consistent way to compare different types of clusterings, simplifying analysis and interpretation.
  • CluSim as a comprehensive toolkit: By consolidating numerous similarity measures and random model comparisons into a single Python package, CluSim democratizes advanced clustering analysis and promotes standardization.
  • Revealing subtle patterns in biological data: The applications demonstrate how CluSim can uncover nuanced insights, such as identifying specific taxa with conflicting evolutionary histories or evaluating clustering performance more rigorously.

Key Results

The paper's key results are demonstrated through its examples:

  • In the gene expression data example, using a more appropriate random model (one-sided fixed number of clusters) revealed that the Hierarchical Clustering result was less similar to the ground truth than a random clustering, a conclusion that differed from using the traditional permutation model.
  • The phylogenetic tree analysis using element-centric comparisons showed that while there were few conflicts near the root of the trees (high similarity), conflicts increased towards the leaves. This analysis also successfully identified specific taxa with structural discrepancies and low phylogenetic support.

Limitations and Future Work

  • Limitations: The paper doesn't explicitly detail limitations of the CluSim package itself, but it implicitly points out that the choice of random model is critical and can be complex. The analytic solutions for chance correction are only available for a subset of measures.
  • Future Work: The paper suggests that CluSim is a foundational tool, and future work could involve expanding the library of similarity measures, incorporating more sophisticated random models, and developing more advanced visualization tools for clustering comparisons. The element-centric approach itself opens avenues for further theoretical development and application.

Summary updated

Abstract

Summary Quantifying the similarity of clusterings is a fundamental step in data analysis. Clustering similarity is the basis for method evaluation, consensus clustering, and tracking the temporal evolution of clusters, among many other tasks. Here we provide CluSim , a comprehensive Python package for the comparison of partitions, overlapping clusterings, and hierarchical clusterings (dendrograms) with more than 20 similarity measures. The CluSim package provides both analytic and empirical methods for assessing the similarity of clusterings in the context of a random model, and provides the novel element-centric approaches for clustering similarity measure that we introduced recently. We illustrate the use of the package through two examples: an evaluation of the clustering of Gene Expression data in the context of different random models, and detailed analysis of model incongruence using element-centric comparisons between a set of phylogentic trees (dendrograms). Availability and implementation The CluSim Python package and accompanying jupyter notebook is available at https://github.com/Hoosier-Clusters/clusim with the MIT open source licence. Contact [email protected] or [email protected]
BibTeX
@misc{gates2018clusim,
  author = {Alexander J. Gates and Yong‐Yeol Ahn},
  title = {{CluSim: a Python package for the comparison of clusterings and dendrograms}},
  year = {2018},
  doi = {10.1101/410084},
  howpublished = {bioRxiv},
}
Figure