Skip to main content

Self-consistency metrics for representational stability analysis

Project description

PyPI version Tests Documentation Status CodeFactor DOI License PyPI Downloads

Shesha Logo

Shesha

Self-consistency metrics for representational stability analysis.

Shesha measures the geometric stability of high-dimensional representations by quantifying the self-consistency of their pairwise distance structure (RDMs) under controlled internal perturbations.

Full documentation at shesha-geometry.readthedocs.io

Installation

pip install shesha-geometry

For single-cell biology workflows (shesha.bio), install with the bio extra, which adds anndata and scikit-learn:

pip install shesha-geometry[bio]

Quick Start

import numpy as np
import shesha

X = np.random.randn(500, 768)  # (n_samples, n_features)

stability = shesha.feature_split(X, n_splits=30, seed=320)
print(f"Feature-split stability: {stability:.3f}")

For the full API reference, installation guide, and usage examples, see the documentation.

Tutorials

Explore shesha with these interactive notebooks (each takes < 5 minutes to run):

  • Open In Colab LLM Embeddings - Analyze embedding stability across layers and models using feature_split.
  • Open In Colab Steering Vectors - Compute steering vectors from contrastive pairs and measure their consistency.
  • Open In Colab Vision Models - Compare geometric stability across ResNets, ViTs, and other architectures.
  • Open In Colab Representational Drift - Measure drift from Gaussian noise injection and LoRA fine-tuning.
  • Open In Colab Training Dynamics - Track geometric stability during training to detect representation collapse.
  • Open In Colab CRISPR (Bio) - Use shesha.bio to analyze stability in single-cell CRISPR perturbation experiments.
  • Open In Colab CRISPR Split-Half Reproducibility (Bio) - Measure effect-direction reproducibility with split_half_reproducibility and control for magnitude confounds with magnitude_matched_comparison.

Citation

If you use shesha-geometry, please cite:

@software{shesha2026,
  title = {Shesha: Self-Consistency Metrics for Representational Stability},
  author = {Raju, Prashant C.},
  year = {2026},
  howpublished = {Zenodo},
  doi = {10.5281/zenodo.18227453},
  url = {https://doi.org/10.5281/zenodo.18227453},
  copyright = {MIT License}
}

@article{raju2026geometric,
  title = {Geometric Stability: The Missing Axis of Representations},
  author = {Raju, Prashant C.},
  journal = {arXiv preprint arXiv:2601.09173},
  year = {2026}
}

If you use the supervised variants (supervised_alignment, lda_stability, variance_ratio, class_separation_ratio), please also cite:

@inproceedings{raju2026canary
  title = {The Geometric Canary: Predicting Steerability and Detecting Drift via Representational Stability},
  author = {Raju, Prashant C.},
  booktitle= {Mechanistic Interpretability Workshop at ICML 2026},
  year= {2026}
}

If you use the shesha.bio module, please also cite:

@article{raju2026crispr,
  title = {Geometric Coherence of Single-Cell CRISPR Perturbations Reveals Regulatory Architecture and Predicts Cellular Stress},
  author = {Raju, Prashant C.},
  journal = {arXiv preprint arXiv:2604.16642},
  year = {2026}
}

License

MIT


Logo generated by Nano Banana Pro

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

shesha_geometry-0.2.24.tar.gz (49.4 kB view details)

Uploaded Source

Built Distribution

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

shesha_geometry-0.2.24-py3-none-any.whl (54.2 kB view details)

Uploaded Python 3

File details

Details for the file shesha_geometry-0.2.24.tar.gz.

File metadata

  • Download URL: shesha_geometry-0.2.24.tar.gz
  • Upload date:
  • Size: 49.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for shesha_geometry-0.2.24.tar.gz
Algorithm Hash digest
SHA256 148f67f5a7d56cec397581b6daf1ceb495b6ac6c160b4708b166faff3d2ddd8d
MD5 b71bec1d6a2ceb1ea0ac7e3c7d477380
BLAKE2b-256 1f7b125cf9f02e4c39d8d43b284ed2af688a14e3b4062f16ea89cf3dfda31154

See more details on using hashes here.

File details

Details for the file shesha_geometry-0.2.24-py3-none-any.whl.

File metadata

File hashes

Hashes for shesha_geometry-0.2.24-py3-none-any.whl
Algorithm Hash digest
SHA256 edf5839bc853c31792b8daac6b3c2b0730c310fe082ef34a9ff8ae366bc0993c
MD5 ef04a25421564983f09e7bee41bf70d4
BLAKE2b-256 16a93788971d4eabb78f6ee569f1d537113595995db7a73e53210640cd8dba37

See more details on using hashes here.

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