Skip to main content

ERICA - Evaluating Replicability via Iterative Clustering Assignments

Project description

ERICA: Evaluating Replicability via Iterative Clustering Assignments

Python 3.8+ License: MIT PyPI version

ERICA is a Python implementation for assessing clustering replicability using Monte Carlo subsampling (MCSS). Because finding clusters is easy—finding clusters that actually exist is the hard part.

The method evaluates whether cluster structures identified in a dataset are stable and reproducible across random subsamples, providing quantitative metrics for clustering validity assessment.

Installation

pip install erica

# With visualization support
pip install erica[plots]

# With graphical interface (for those who prefer clicking)
pip install erica[gui]

Basic Usage

from erica import ERICA
from erica.data import load_data

# Load data (samples × features format)
data = load_data('expression_data.csv')

# Initialize and run analysis
# method='both' runs K-Means, Agglomerative (Single), and Agglomerative (Ward)
erica = ERICA(
    data=data,
    k_range=[2, 3, 4, 5, 6, 7, 8],
    n_iterations=200,
    method='both'  # K-Means + Agglomerative (Single & Ward)
)
results = erica.run()

# Retrieve recommended cluster number
k_star = erica.get_k_star('TWCRI')
print(f"Recommended K: {k_star['kmeans']}")

Documentation

Document Description
Documentation Index Complete documentation
Getting Started Installation and tutorial
Metrics Guide ERICA Statistic, WCRI, TWCRI explained
API Reference Function documentation
Methodology The science behind the magic

Example Scripts

# Script Description
1 01_basic_usage.py Synthetic data analysis
2 02_vdx_analysis.py Breast cancer gene expression (VDX dataset)
3 03_k_star_selection.py K* selection via Algorithm 2
4 04_advanced_usage.py Component-level workflows
5 05_parmigiani_metrics.py ARI/AMI partition comparison metrics

See examples/README.md for details and data acquisition instructions.

Data Format

ERICA operates on data in samples × features format. (Yes, the orientation matters. We've all learned this the hard way.)

Data Type Input Format Parameter
Genomics (genes × samples) Features in rows transpose=True (default)
Standard (samples × features) Samples in rows transpose=False

Replicability Metrics

ERICA implements two families of replicability metrics:

ERICA Metrics (CLAM-based)

ERICA Statistic (Clustering Replicability Index) is the core metric. It measures how consistently samples are assigned to their primary cluster across Monte Carlo iterations.

Metric Role Definition
ERICA Statistic Core metric Proportion of iterations where samples are assigned to their primary cluster
WCRI Derived CRI (i.e. ERICA statistic) weighted by cluster size
TWCRI Aggregate Sum of WCRI (used for K* selection)

Parmigiani Metrics (Partition Comparison)

Based on Parmigiani et al. (2023) "Cross-Study Replicability in Cluster Analysis":

Metric Definition
ARI Adjusted Rand Index - partition similarity adjusted for chance
AMI Adjusted Mutual Information - information-theoretic comparison

Interpretation

Value Range Interpretation
> 0.8 High replicability (publishable with confidence)
0.6–0.8 Moderate replicability (proceed with caution)
< 0.6 Low replicability (perhaps try a different K)

See the Metrics Guide for detailed explanations.

Sample Datasets

Dataset Description Source
VDX Breast cancer gene expression (22,283 genes × 344 samples) Parmigiani et al.
VDX_3_SV Reduced 3-gene subset (344 samples) Included in examples/data/

Requirements

Core: Python ≥ 3.8, NumPy, Pandas, scikit-learn, PyYAML

Optional: Plotly (visualization), Gradio (GUI)

Citation

If you use ERICA in your research, please cite:

@software{erica2025,
  title = {ERICA: Evaluating Replicability via Iterative Clustering Assignments},
  author = {Sorooshyari, Siamak and Shirazi, Shawn},
  year = {2025},
  url = {https://github.com/PhenomML/ERICA}
}

License

MIT License. See LICENSE for details.

Contact

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

erica-0.2.4.tar.gz (400.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

erica-0.2.4-py3-none-any.whl (43.4 kB view details)

Uploaded Python 3

File details

Details for the file erica-0.2.4.tar.gz.

File metadata

  • Download URL: erica-0.2.4.tar.gz
  • Upload date:
  • Size: 400.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for erica-0.2.4.tar.gz
Algorithm Hash digest
SHA256 8153a29492d68ea22c1be18213d3d2fb4cab5a285b06271979bcc82ef9f12a80
MD5 ea14ba15fef8a8e80558966d29bab25e
BLAKE2b-256 4884250f73908786694d0b42164d8e571faa89818543c2ddd665851b2bdb299d

See more details on using hashes here.

Provenance

The following attestation bundles were made for erica-0.2.4.tar.gz:

Publisher: publish.yml on PhenomML/ERICA

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file erica-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: erica-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 43.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for erica-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 6b389d01cdefbd732f42e5ea2ad44dc272b797434f54c33c9a2146567fa9e2e1
MD5 4bee088eff0c174f36f3041a9280d89f
BLAKE2b-256 d60f625614f1888eaf35aa99649c6958f5d44f477dccef5c9a162dd18116777a

See more details on using hashes here.

Provenance

The following attestation bundles were made for erica-0.2.4-py3-none-any.whl:

Publisher: publish.yml on PhenomML/ERICA

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page