Unsupervised Metrics¶
These metrics require no labels and measure the internal geometric consistency of a representation.
Feature split¶
shesha.feature_split() randomly partitions features into two halves, computes
an RDM for each half, and returns their Spearman correlation. High values indicate
that the geometry is robust to which features you use — a sign of stable structure.
import shesha
stability = shesha.feature_split(X, n_splits=30, metric='cosine', seed=320)
Sample split¶
shesha.sample_split() bootstraps the sample dimension instead. It measures
robustness to which data points are observed.
stability = shesha.sample_split(X, n_splits=30, subsample_fraction=0.4)
Anchor stability¶
shesha.anchor_stability() computes distance profiles from a fixed set of anchor
points and correlates them across two bootstrap draws. Suitable for very large datasets.
stability = shesha.anchor_stability(X, n_splits=30, n_anchors=100)
Bootstrap confidence intervals¶
All unsupervised metrics support optional bootstrap CIs via n_bootstrap_ci.
See Bootstrap Confidence Intervals for full details.
result = shesha.feature_split(X, n_splits=30, seed=320, n_bootstrap_ci=1000)
print(f"{result['mean']:.3f} [{result['ci_low']:.3f}, {result['ci_high']:.3f}]")