Skip to main content

PyPI version Tests Documentation Status CodeFactor DOI License PyPI Downloads

Shesha Logo

Shesha

Pronunciation: SHAY-shuh (/ˈʃeɪʃə/)

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.

Known limitations

  • feature_split measures coordinate-axis redundancy, not basis-invariant geometry. Orthogonal rotations can change the score while leaving pairwise Euclidean RDMs unchanged. See What Shesha does not establish.
  • sample_split and anchor_stability correlate unmatched distance entries. Their current outputs must not be used for scientific inference; they emit FutureWarning and will be replaced in 0.3.0.

Tutorials

Explore shesha with these interactive notebooks (most take < 5 minutes; the vision tutorial is longer because it loads several pretrained models):

  • 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 coherence in single-cell CRISPR perturbation experiments.

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= {ICML Mechanistic Interpretability Workshop},
  year= {2026}
}

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

@article{raju2026crispr,
  title = {Directional coherence and effect magnitude in single-cell CRISPR perturbation responses},
  author = {Raju, Prashant C.},
  journal = {arXiv preprint arXiv:2604.16642},
  year = {2026}
}

License

MIT


Logo generated by Nano Banana Pro

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.29.tar.gz (70.2 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.29-py3-none-any.whl (33.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: shesha_geometry-0.2.29.tar.gz
  • Upload date:
  • Size: 70.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for shesha_geometry-0.2.29.tar.gz
Algorithm Hash digest
SHA256 e9b9f17a17a9ab8701af3ff6ca2c922aa978ea83aeb6f7a748fa22f61283bde2
MD5 763408f958ec8f36b15271c832ae173b
BLAKE2b-256 7d99e0e36473413033ab3bc6fa880a37d7db78d8542474681b1eee288c184450

See more details on using hashes here.

Provenance

The following attestation bundles were made for shesha_geometry-0.2.29.tar.gz:

Publisher: publish.yml on prashantcraju/shesha

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

File details

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

File metadata

File hashes

Hashes for shesha_geometry-0.2.29-py3-none-any.whl
Algorithm Hash digest
SHA256 d19bbc77003e4c6e0ec579913d1510d167b6f2cb3dd3943b2f1f80711fca3d97
MD5 e2e946e29066dd1dfa14b9aa05b95d32
BLAKE2b-256 674e525c0f682cf3d1a0528623acd88141eb4c56953e985bb902116fd4fa6aea

See more details on using hashes here.

Provenance

The following attestation bundles were made for shesha_geometry-0.2.29-py3-none-any.whl:

Publisher: publish.yml on prashantcraju/shesha

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

Release history Release notifications | RSS feed

This release

0.2.29 This release

2 files

0.2.28

2 files

0.2.27

2 files

0.2.26

2 files

0.2.25

2 files

0.2.24

2 files

0.2.23

2 files

0.2.22

2 files

0.2.21

2 files

0.2.20

2 files

0.2.18

2 files

0.2.17

2 files

0.2.16

2 files

0.2.15

2 files

0.2.14

2 files

0.2.13

2 files

0.2.12

2 files

0.2.11

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.32

2 files

0.1.31

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page