ERICA - Evaluating Replicability via Iterative Clustering Assignments
Project description
ERICA: Evaluating Replicability via Iterative Clustering Assignments
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-clustering
# With visualization support
pip install erica-clustering[plots]
# With graphical interface (for those who prefer clicking)
pip install erica-clustering[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 | CRI, 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)
CRI (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 |
|---|---|---|
| CRI | Core metric | Proportion of iterations where samples are assigned to their primary cluster |
| WCRI | Derived | CRI 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/sorooshyari/ERICA}
}
License
MIT License. See LICENSE for details.
Contact
- Issues: GitHub Issues
- Email: s.shirazi@berkeley.edu, siamak_sorooshyari@yahoo.com
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file erica-0.1.4.tar.gz.
File metadata
- Download URL: erica-0.1.4.tar.gz
- Upload date:
- Size: 39.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da034a5095eb00611df30dcf6611fc97992b2f5e5d8f65e9a628f852a4aadb79
|
|
| MD5 |
f35eb16c5a3cd0e6a393a27b84ded031
|
|
| BLAKE2b-256 |
2e72644a15cacec2c88e71c63f211c1441bb7ea41ea5f4c79641d5629c4f9ef4
|
Provenance
The following attestation bundles were made for erica-0.1.4.tar.gz:
Publisher:
publish.yml on PhenomML/ERICA
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
erica-0.1.4.tar.gz -
Subject digest:
da034a5095eb00611df30dcf6611fc97992b2f5e5d8f65e9a628f852a4aadb79 - Sigstore transparency entry: 1197265985
- Sigstore integration time:
-
Permalink:
PhenomML/ERICA@15ef715b7a9a28982f857507ac0bda8d349faa36 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/PhenomML
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@15ef715b7a9a28982f857507ac0bda8d349faa36 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file erica-0.1.4-py3-none-any.whl.
File metadata
- Download URL: erica-0.1.4-py3-none-any.whl
- Upload date:
- Size: 35.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8bfad726a29d3035aa37cf0969dff0b085cfd0b59e128fbe5efb89a49e81e4c7
|
|
| MD5 |
5884b1f9ebb45025ebf94f3a7b97f44b
|
|
| BLAKE2b-256 |
d89696ef6b7f0869358eaef622c1be6561854713edd751ead8b6e6e30d604fe9
|
Provenance
The following attestation bundles were made for erica-0.1.4-py3-none-any.whl:
Publisher:
publish.yml on PhenomML/ERICA
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
erica-0.1.4-py3-none-any.whl -
Subject digest:
8bfad726a29d3035aa37cf0969dff0b085cfd0b59e128fbe5efb89a49e81e4c7 - Sigstore transparency entry: 1197266012
- Sigstore integration time:
-
Permalink:
PhenomML/ERICA@15ef715b7a9a28982f857507ac0bda8d349faa36 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/PhenomML
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@15ef715b7a9a28982f857507ac0bda8d349faa36 -
Trigger Event:
workflow_dispatch
-
Statement type: