| Crates.io | amari-info-geom |
| lib.rs | amari-info-geom |
| version | 0.17.0 |
| created_at | 2025-10-03 20:58:50.446892+00 |
| updated_at | 2026-01-11 22:34:25.713887+00 |
| description | Information geometry and statistical manifolds |
| homepage | https://github.com/justinelliottcobb/Amari |
| repository | https://github.com/justinelliottcobb/Amari |
| max_upload_size | |
| id | 1867192 |
| size | 211,729 |
Information geometry and statistical manifolds for the Amari library.
amari-info-geom implements the foundational concepts of information geometry, the study of probability distributions as points on a Riemannian manifold. This crate provides tools for working with Fisher metrics, α-connections, Bregman divergences, and the Amari-Chentsov tensor structure.
Named after Shun-ichi Amari, the pioneer of information geometry.
Add to your Cargo.toml:
[dependencies]
amari-info-geom = "0.12"
[dependencies]
# Default features
amari-info-geom = "0.12"
# With GPU acceleration
amari-info-geom = { version = "0.12", features = ["gpu"] }
# High-precision arithmetic
amari-info-geom = { version = "0.12", features = ["high-precision"] }
use amari_info_geom::{kl_divergence, js_divergence, bregman_divergence};
use amari_core::Multivector;
type Cl3 = Multivector<3, 0, 0>;
// Create probability-like multivectors
let p = Cl3::from_coefficients(&[0.5, 0.3, 0.1, 0.1, 0.0, 0.0, 0.0, 0.0]);
let q = Cl3::from_coefficients(&[0.4, 0.4, 0.1, 0.1, 0.0, 0.0, 0.0, 0.0]);
// Compute divergences
let kl = kl_divergence(&p, &q)?;
let js = js_divergence(&p, &q)?;
// Bregman divergence with custom potential
let phi = |mv: &Cl3| mv.norm_squared();
let breg = bregman_divergence(phi, &p, &q)?;
A statistical manifold S is a set of probability distributions with a smooth structure:
S = { p_θ : θ ∈ Θ ⊂ ℝⁿ }
The Fisher information metric defines a Riemannian structure:
g_ij(θ) = E_θ[∂_i log p_θ · ∂_j log p_θ]
This metric measures the "distance" between nearby distributions.
A family of affine connections parameterized by α:
When α = +1 and α = -1 connections are both flat, the manifold is dually flat. This structure underlies:
| Divergence | Formula | Properties |
|---|---|---|
| KL | D_KL(p‖q) = Σ p log(p/q) | Asymmetric, non-negative |
| JS | D_JS(p‖q) = ½D_KL(p‖m) + ½D_KL(q‖m) | Symmetric, bounded |
| Bregman | D_φ(p‖q) = φ(p) - φ(q) - ⟨∇φ(q), p-q⟩ | Generalizes squared distance |
Objects usable as parameters on statistical manifolds:
use amari_info_geom::Parameter;
// Multivectors implement Parameter
let mv = Multivector::<3, 0, 0>::zero();
let dim = mv.dimension();
let component = mv.get_component(0);
#[cfg(feature = "gpu")]
use amari_info_geom::{InfoGeomGpuOps, GpuStatisticalManifold};
let gpu_ops = InfoGeomGpuOps::new().await?;
let manifold = GpuStatisticalManifold::new(/* ... */);
let fisher = gpu_ops.compute_fisher_metric(&manifold).await?;
| Module | Description |
|---|---|
gpu |
GPU-accelerated operations (feature-gated) |
verified_contracts |
Formal verification contracts |
The crate is based on Amari's foundational work:
Licensed under either of Apache License, Version 2.0 or MIT License at your option.
This crate is part of the Amari mathematical computing library, named in honor of Shun-ichi Amari's contributions to information geometry.