Geometric analysis of cetacean communication — hyperbolic embeddings, topological data analysis, and adversarial robustness testing for whale vocalization decoding
Project description
eris-ketos
Geometric analysis of cetacean communication. Hyperbolic embeddings, topological data analysis, and adversarial robustness testing for whale vocalization decoding.
ketos (κῆτος) — Greek for "sea creature," the root of "cetacean."
Part of the ErisML family.
Why geometry?
Sperm whale codas have a combinatorial phonetic system — rhythm, tempo, rubato, and ornamentation combine hierarchically (Sharma et al., Nature Communications 2024). Standard ML treats these as flat feature vectors. But hierarchical structures embed naturally in hyperbolic space with exponentially less distortion than Euclidean space.
eris-ketos provides three geometric analysis methods and an adversarial robustness framework:
| Module | Method | What it captures |
|---|---|---|
poincare_coda |
Poincaré ball embeddings | Hierarchical coda structure, taxonomic relationships |
tda_clicks |
Persistent homology | Topological shape of vocal attractors |
spd_spectral |
SPD manifold metrics | Spectral covariance ("vowel" patterns) |
decoder_robustness |
Adversarial fuzzing (DRI) | Decoder failure modes under acoustic perturbations |
Installation
pip install eris-ketos # core (numpy, scipy, torch, librosa)
pip install eris-ketos[tda] # + ripser, persim
pip install eris-ketos[ml] # + timm, torchaudio, scikit-learn
pip install eris-ketos[all] # everything
Quick start
from eris_ketos import PoincareBall, HyperbolicMLR
# Embed coda features on the Poincaré ball
ball = PoincareBall(c=1.0)
coda_features = torch.randn(100, 32) # 100 codas, 32-dim features
embeddings = ball.expmap0(coda_features * 0.1)
# Classify with hyperbolic distances to learned prototypes
classifier = HyperbolicMLR(embed_dim=32, num_classes=21, c=1.0)
logits = classifier(embeddings)
from eris_ketos import compute_persistence, tda_feature_vector
# Topological analysis of click patterns
audio = librosa.load("sperm_whale_coda.wav", sr=32000)[0]
persistence = compute_persistence(audio, delay=10, dim=3)
features = tda_feature_vector(persistence) # fixed-length topological summary
from eris_ketos import DecoderRobustnessIndex, make_acoustic_transform_suite
# Test how robust a decoder is to acoustic perturbations
transforms = make_acoustic_transform_suite()
dri = DecoderRobustnessIndex(transforms)
score = dri.measure(decoder, codas)
print(f"Decoder Robustness Index: {score.dri:.4f}")
Modules
poincare_coda — Hyperbolic embeddings
Poincaré ball operations (exponential/logarithmic maps, Möbius addition, geodesic distance) and HyperbolicMLR for classification via distance to learned prototypes on the ball. Prototypes can be initialized from a taxonomic tree.
tda_clicks — Topological data analysis
Time-delay embedding (Takens' theorem) reconstructs the vocal attractor from click sequences. Persistent homology (via ripser) computes topological features — connected components (H0) and loops (H1) — that distinguish coda types and social units.
spd_spectral — SPD manifold analysis
Frequency-band covariance matrices are symmetric positive definite (SPD). The log-Euclidean Riemannian metric on this manifold is more discriminative than Euclidean distance for spectral patterns, capturing the "vowel-like" formant structure in whale clicks (Begus et al., Open Mind 2025).
acoustic_transforms — Parametric perturbations
Library of acoustic transforms with controllable intensity (0.0–1.0): additive noise, Doppler shift, multipath echo, time stretch, click dropout, conspecific overlay, and more. Supports compositional chains for compound distortion testing.
decoder_robustness — Decoder Robustness Index (DRI)
Adapted from the ErisML Bond Index adversarial fuzzing framework. Measures decoder reliability via graduated semantic distance, adversarial threshold search, sensitivity profiling, and compositional chain analysis.
Data
eris-ketos works with the DSWP dataset (1,501 annotated sperm whale codas, CC BY 4.0) — the same data behind the Sharma et al. 2024 Nature paper.
from eris_ketos.data import load_dswp
codas = load_dswp() # downloads from HuggingFace on first call
References
- Sharma, P. et al. "Contextual and combinatorial structure in sperm whale vocalisations." Nature Communications 15, 3617 (2024).
- Begus, G. et al. "Vowel- and diphthong-like spectral patterns in sperm whale codas." Open Mind (MIT Press, 2025).
- Project CETI — WhAM. NeurIPS 2025.
- Bond, A.H. "ErisML: Geometric ethics framework." erisml-lib.
License
MIT
Project details
Release history Release notifications | RSS feed
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 eris_ketos-0.1.0.tar.gz.
File metadata
- Download URL: eris_ketos-0.1.0.tar.gz
- Upload date:
- Size: 25.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0f51fba53c0274bdb2f3047292a6974d0721c474531b300fc87be7bd52d83ac
|
|
| MD5 |
0840dc5c300e452d7f89c0e9c19de13b
|
|
| BLAKE2b-256 |
77803579f7937e76d99adf97e3cd21577cefa5b9aeaf95f103a0cafab0c76acd
|
File details
Details for the file eris_ketos-0.1.0-py3-none-any.whl.
File metadata
- Download URL: eris_ketos-0.1.0-py3-none-any.whl
- Upload date:
- Size: 22.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a781e9f4198b3454dda58549598925b0773770c65ad8427dbfd892039367d7f
|
|
| MD5 |
cdde735d5667e2cfae9030ba176b4cc8
|
|
| BLAKE2b-256 |
b220d34f4a2747858f062a379837139c3943b98787353f01b14833d4b3f9254d
|