Gauge-fixed KAN models for passive-sonar range-frequency fields.
Project description
SonarKAN Python package
sonarkan implements the gauge-fixed additive-plus-low-rank model. The package provides the model, B-spline edge functions, SWellEx-96 data utilities, acoustic/statistical baselines, experiment runners, checkpoint loading, reporting, and the two submitted figure generators.
The canonical spelling is SonarKAN for the project and model class, and sonarkan for the Python package.
Official resources
GitHub https://github.com/soundai2016/SonarKAN
Outputs https://huggingface.co/soundai2016/SonarKAN
Model
For range r and frequency f, SonarKAN represents the received-level field as
y_hat(r, f) = b + phi_r(r) + phi_f(f) + phi_abs(r, f)
+ sum_k u_k(r) v_k(f)
phi_randphi_fare learned one-dimensional B-spline edge functions.phi_absis an optional prescribed or parameterized absorption contribution.- The final term is a rank-
Kinteraction branch. K = 0is the additive member of the same model family.- Gauge fixing centers the learned marginals and removes lower-order row/column means from the aggregate interaction, so coupling diagnostics are attached to the centered interaction rather than leaked main effects.
Individual low-rank factors are not uniquely interpretable under rotations and rescalings; use the aggregate interaction field exported in components.pt for interpretation.
Installation
From the source-repository root:
python -m pip install -e ./src
Or from this directory:
python -m pip install -e .
The package requires Python 3.10 or newer and installs NumPy, PyTorch, Matplotlib, and PyYAML as runtime dependencies.
Public API
from sonarkan import (
SonarKAN,
SonarKANConfig,
SmallMLP,
load_sonarkan_model_bundle,
predict_from_bundle,
predict_rl,
)
A minimal additive model can be constructed with:
from sonarkan import SonarKAN, SonarKANConfig
config = SonarKANConfig(interaction_rank=0)
model = SonarKAN(r_min_m=900.0, r_max_m=8700.0, cfg=config)
Training in the submitted experiments is configured through ../configs/config.yaml and run through ../scripts/run.py; the package does not install a separate console entry point.
Load a retained checkpoint
sonarkan_model.pt is a dictionary bundle with format identifier SonarKAN_model_bundle. It stores the state dictionary, model configuration, physical normalization bounds, and training metadata.
From the source-repository root:
from sonarkan import load_sonarkan_model_bundle, predict_rl
checkpoint = (
"outputs/results/selected_models/"
"swellex96_s5_vla/selected_K00/run/sonarkan_model.pt"
)
model, metadata = load_sonarkan_model_bundle(checkpoint, device="cpu")
prediction_db = predict_rl(
model,
r_m=[1000.0, 2000.0],
f_hz=[49.0, 388.0],
normalization=metadata["normalization"],
progress_bar=False,
)
print(prediction_db)
The convenience wrapper predict_from_bundle(...) loads the bundle and performs the same normalization automatically.
PyTorch .pt files use Python serialization. Load checkpoints and component files only from a trusted source.
Checkpoints versus component exports
| File | Purpose |
|---|---|
sonarkan_model.pt |
Loadable model bundle for inference or continued analysis |
components.pt |
Precomputed marginal curves, interaction grid, held-out predictions, and diagnostic metadata used for interpretation and Figure 2 |
results.json |
Single-run metrics, baseline details, and training history |
results_cv.json |
Blocked-CV aggregate metrics, fold assignments, and fold summaries |
components.pt is not a model checkpoint and does not contain everything required to reconstruct the network.
Plotting API
The package exports:
from sonarkan.plots import plot_figure1, plot_figure2
plot_figure1 is self-contained. plot_figure2 requires the two processed event files and their fixed-K = 16 components.pt artifacts. Most users should call the repository-level wrapper instead:
python scripts/plot.py --config configs/config.yaml --force
It writes:
outputs/figures/fig1_framework.pdf
outputs/figures/fig2_decomposition.pdf
Package layout
sonarkan/models.py SonarKAN, spline edges, absorption, and MLP baseline
sonarkan/deploy.py checkpoint loading and batched prediction
sonarkan/baselines.py parametric TL, GAM, WGI, and modal baselines
sonarkan/data/ SIO, SWellEx-96, range, VLA, and CTD utilities
sonarkan/experiments/ preprocessing, training, CV, rank, and transfer studies
sonarkan/plots/figure1.py manuscript Figure 1
sonarkan/plots/figure2.py manuscript Figure 2
sonarkan/reporting.py manuscript CSV tables
sonarkan/utils/ configuration, paths, seeds, and PyTorch compatibility
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 sonarkan-1.1.0.tar.gz.
File metadata
- Download URL: sonarkan-1.1.0.tar.gz
- Upload date:
- Size: 84.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ebb113417983c142cd6080c7ad032fec28d0a122f5d1ec3d5fc33deff48a8a0
|
|
| MD5 |
fd35fcbb1f39b4d75697212abaec7c3f
|
|
| BLAKE2b-256 |
58107453f01af2c379ebb2c55efb3d627dadb5dc372b41791540c6b9b5775f11
|
Provenance
The following attestation bundles were made for sonarkan-1.1.0.tar.gz:
Publisher:
python-publish.yml on soundai2016/SonarKAN
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sonarkan-1.1.0.tar.gz -
Subject digest:
7ebb113417983c142cd6080c7ad032fec28d0a122f5d1ec3d5fc33deff48a8a0 - Sigstore transparency entry: 2180777794
- Sigstore integration time:
-
Permalink:
soundai2016/SonarKAN@0213cbeb7fa00905198a80b3d2ea241cfc9da158 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/soundai2016
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@0213cbeb7fa00905198a80b3d2ea241cfc9da158 -
Trigger Event:
release
-
Statement type:
File details
Details for the file sonarkan-1.1.0-py3-none-any.whl.
File metadata
- Download URL: sonarkan-1.1.0-py3-none-any.whl
- Upload date:
- Size: 94.7 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 |
77c04e6b3e93e6865fa73a69ade33a7aba25326ea29822fd8ccc5fef2305349e
|
|
| MD5 |
353944c5979836ee1916277d92262664
|
|
| BLAKE2b-256 |
4ba90d521465542ebe7d113dfda2223c9f44f06ecfcf5c799cea716b2a22a18e
|
Provenance
The following attestation bundles were made for sonarkan-1.1.0-py3-none-any.whl:
Publisher:
python-publish.yml on soundai2016/SonarKAN
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sonarkan-1.1.0-py3-none-any.whl -
Subject digest:
77c04e6b3e93e6865fa73a69ade33a7aba25326ea29822fd8ccc5fef2305349e - Sigstore transparency entry: 2180777990
- Sigstore integration time:
-
Permalink:
soundai2016/SonarKAN@0213cbeb7fa00905198a80b3d2ea241cfc9da158 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/soundai2016
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@0213cbeb7fa00905198a80b3d2ea241cfc9da158 -
Trigger Event:
release
-
Statement type: