ERICA: Evaluating Replicability via Iterative Clustering Assignments
ERICA is a Python implementation for assessing clustering replicability using Monte Carlo subsampling (MCSS). Declaring clusters is not difficult, but finding clusters that can be quantitatively shown to exist in a replicable manner is difficult.
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 Masoero et al. (2023) "Cross-Study Replicability in Cluster Analysis" (Parmigiani is a senior author, hence use of his name):
| 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) | Masoero 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
- Issues: GitHub Issues
- Email: s.shirazi@berkeley.edu, siamak_sorooshyari@yahoo.com
Metadata
Release files for erica 0.2.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| erica-0.2.5.tar.gz | 1.3 MB | With provenance | Details for erica-0.2.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| erica-0.2.5-py3-none-any.whl | Python 3 | none | any | Details for erica-0.2.5-py3-none-any.whl |
Total release size: 1.3 MB
Release files / erica-0.2.5.tar.gz
| Download URL | erica-0.2.5.tar.gz |
|---|---|
| Size | 1.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4abbc0a91794ad6cc51c679968e2174a5472aaf2cf50d8432561ac0664dcf12e
|
|
BLAKE2b-256 checksum How to use checksums |
4157899361655a96a1a5fef0e80058ad01e0666c0c5cf6c15c6855cc175b7172
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 24, 2026.
Transparency logRelease files / erica-0.2.5-py3-none-any.whl
| Download URL | erica-0.2.5-py3-none-any.whl |
|---|---|
| Size | 44.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4467f2e11f3b58b616feec78475d41eb0702f128e816f9bc752f46c1bbcc30b7
|
|
BLAKE2b-256 checksum How to use checksums |
fa7a288c02a391e0c261bce89d5b9710335273c0da60a048435b0f90702444a5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 24, 2026.
Transparency logSecurity for erica 0.2.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for erica-0.2.5.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 24, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.