Canonical simplex geometry via the Fisher amplitude lift, with low-complexity invariant tools
Project description
fisher-simplex
A boundary-safe information-geometry toolkit for probability-simplex data, built around the Fisher/Hellinger square-root embedding and extended with canonical low-complexity invariant diagnostics.
Use it when your data are normalized nonnegative vectors and you need principled distances, means, interpolation, and low-order structural summaries without ad hoc zero handling.
Need a different language than Python? fisher-simplex maintains a SPEC.md in order to serve as a ghost library. Clone the repository as reference and point your favorite coding agent at the specification to reproduce with your unique requirements met.
Positioning
Primarily a geometry toolkit — exact Fisher/Hellinger distances, means, geodesics, tangent PCA, and kernel methods on the probability simplex.
Secondarily a low-complexity invariant toolkit — canonical overlap diagnostics and forced-pair summaries (Q_delta, H_3) grounded in the Fisher-lifted symmetric-even harmonic sector.
Installation
pip install fisher-simplex
For visualization support:
pip install "fisher-simplex[viz]"
Or install from source:
git clone <repo-url> && cd fisher-simplex
pip install -e ".[dev,viz]"
Quick usage
import numpy as np
import fisher_simplex as fs
# Two probability vectors
a = np.array([0.5, 0.3, 0.2])
b = np.array([0.1, 0.6, 0.3])
# Fisher distance (geodesic distance on the simplex)
d = fs.fisher_distance(a, b)
print(f"Fisher distance: {d:.4f}")
# Extrinsic Fisher mean of a cloud
cloud = np.array([
[0.5, 0.3, 0.2],
[0.1, 0.6, 0.3],
[0.3, 0.3, 0.4],
])
mean = fs.fisher_mean(cloud) # extrinsic projected mean
print(f"Fisher mean: {mean}")
# Forced coordinates (Q_delta, H_3)
coords = fs.forced_coordinates(cloud)
print(f"Forced coordinates:\n{coords}")
# Divergence analysis
report = fs.divergence_analysis(cloud)
print(f"Mean divergence: {report['mean_divergence']:.6f}")
Module overview
| Module | Purpose | Status |
|---|---|---|
core |
Scalar invariants, overlap families, forced pair, Fisher lift, bridge statistics | Exact |
geometry |
Distances, geodesics, means, tangent maps, PCA, kernels (linear, polynomial, RBF) | Exact / exact-derived |
analysis |
Batch diagnostics, divergence reports, forced-block analysis, text reports | Exact-derived / heuristic |
generators |
Synthetic reference ensembles (Dirichlet, broken stick, lognormal, etc.) | Engineering |
utils |
Validation, projection, closure | Engineering |
frontier |
Degree-8 enrichment coordinates and residual diagnostics | Experimental |
harmonic |
Low-degree symmetric-even harmonic tools | Experimental |
interp |
Mechanistic interpretability: chart discovery, shared modes, projection | Experimental |
viz |
Matplotlib plotting utilities (requires matplotlib) |
Optional |
Examples
The examples/ directory contains runnable scripts demonstrating domain-specific workflows:
| Example | Domain | Demonstrates |
|---|---|---|
basic_geometry.py |
General | Fisher distance, mean, geodesics, tangent PCA, kernels |
portfolio_rebalancing.py |
Finance | Fisher vs Euclidean distance, geodesic rebalancing, HHI shape correction |
biodiversity_concentration.py |
Ecology / Economics | Overlap diagnostics, forced-pair invariants, concentration profiling |
distributional_shift.py |
Machine learning | Shift detection between classifier output clouds |
sparse_zeros.py |
Microbiome | Boundary-safe geometry on zero-inflated compositional data |
frontier_enrichment.py |
Research | Degree-8 enrichment coordinates, residual diagnostics |
frontier_discrimination.py |
Research | Frontier-based model discrimination |
llm_token_geometry.py |
ML / LLMs | Top-k to simplex, frontier coordinates, drift detection |
dietary_composition.py |
Epidemiology | Closure distortion, forced-pair dietary concentration, boundary safety with zeros |
microbiome_trajectory.py |
Microbiology | Antibiotic response trajectories, Psi boundary alarm, tangent perturbation fingerprinting |
attention_atlas.md |
ML / Interpretability | Chart discovery, shared tangent modes, and replay validation for transformer attention heads |
Documentation
- Quick start — five steps to get going
- User guide — workflows for geometry, diagnostics, and analysis
- Mathematical notes — derivations, theorems, and conventions
Dependencies
Required: Python >= 3.9, NumPy >= 1.21, SciPy >= 1.7
Optional: matplotlib >= 3.5 (viz module)
License
MIT
Citation
Software:
fisher-simplex: Canonical simplex geometry via the Fisher amplitude lift, with low-complexity invariant diagnostics. Version 0.3.
Mathematical attribution:
Fisher-Harmonic programme: overlap-family divergence, low-degree forced compression in the Fisher-lifted symmetric-even sector, and degree-8 selective frontier tools for simplex observables.
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 fisher_simplex-0.4.1.tar.gz.
File metadata
- Download URL: fisher_simplex-0.4.1.tar.gz
- Upload date:
- Size: 222.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
551234fb811f6ac66f76814116191e4bbb52f337866bd93fc5afa53d8ddad495
|
|
| MD5 |
0c8ad60c5b42dc9ed256a0e33b5c0112
|
|
| BLAKE2b-256 |
d4cbfc4e46d47af46e7ab35d278e18a40d59b8f0cc288420811f206f95e3c01e
|
Provenance
The following attestation bundles were made for fisher_simplex-0.4.1.tar.gz:
Publisher:
workflow.yml on syzygyhack/fisher-simplex
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fisher_simplex-0.4.1.tar.gz -
Subject digest:
551234fb811f6ac66f76814116191e4bbb52f337866bd93fc5afa53d8ddad495 - Sigstore transparency entry: 1255646191
- Sigstore integration time:
-
Permalink:
syzygyhack/fisher-simplex@1d7a9642ceb554a6ca086e83d53ddaee736079cd -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/syzygyhack
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@1d7a9642ceb554a6ca086e83d53ddaee736079cd -
Trigger Event:
push
-
Statement type:
File details
Details for the file fisher_simplex-0.4.1-py3-none-any.whl.
File metadata
- Download URL: fisher_simplex-0.4.1-py3-none-any.whl
- Upload date:
- Size: 39.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ebd02b58f68f3fa53ba283cb13e65673139e8825367cb8bf7ad180155ffe52cc
|
|
| MD5 |
1eb4ebc54820bb2e7b4ffec1cc6f0d52
|
|
| BLAKE2b-256 |
5760dbfc9fe0ee2a4de8d5f17aa773fa436f0c01a698b1ef11b6a8700084b854
|
Provenance
The following attestation bundles were made for fisher_simplex-0.4.1-py3-none-any.whl:
Publisher:
workflow.yml on syzygyhack/fisher-simplex
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fisher_simplex-0.4.1-py3-none-any.whl -
Subject digest:
ebd02b58f68f3fa53ba283cb13e65673139e8825367cb8bf7ad180155ffe52cc - Sigstore transparency entry: 1255646598
- Sigstore integration time:
-
Permalink:
syzygyhack/fisher-simplex@1d7a9642ceb554a6ca086e83d53ddaee736079cd -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/syzygyhack
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@1d7a9642ceb554a6ca086e83d53ddaee736079cd -
Trigger Event:
push
-
Statement type: