Abstract
pyBregMan is a Python library designed to facilitate the application of information geometry—specifically Bregman and Fisher-Rao manifolds—in practical research. By leveraging Legendre-Fenchel duality and automatic differentiation, it provides a unified geometric kernel for computing divergences, geodesics, and centroids across various statistical models. This paper introduces the library's core principles, technical implementation, and illustrative applications in Gaussian centroids, matrix means, and information theory.
Introduction
Information geometry treats statistical models as manifolds—curved surfaces where "distance" represents the dissimilarity between probability distributions. While mathematically elegant, implementing these concepts, such as dually flat spaces or Fisher-Rao metrics, is notoriously difficult and error-prone. Researchers often have to "reinvent the wheel" to calculate geometric means or Chernoff information points. pyBregMan fills this gap by providing a standardized, extensible API for these complex geometric operations.
Methodology
The library is built around the core principle of Legendre-Fenchel duality. In this framework, a single strictly convex "generator" function $F$ induces a manifold with two coupled coordinate systems ($\theta$ and $\eta$) and a pair of dual Bregman divergences.
Technical Implementation
- Auto-Differentiation: Using the
autogradlibrary,pyBregManautomatically computes the gradients and Hessians of user-defined convex generators. This allows users to define a new manifold by simply writing a standard Python function for the potential. - Geometric Primitives: The library defines abstract classes for
Point,Manifold,Geodesic, andBisector. It handles coordinate transformations (e.g., moving between "natural" and "expectation" parameters) behind the scenes. - Duality as a First-Class Citizen: Many statistical quantities are defined by the interaction of primal and dual spaces. For example, the Chernoff point is found at the intersection of a primal geodesic and a dual bisector.
pyBregManmaps these mathematical concepts directly to an object-oriented hierarchy.
Applications and Results
The library comes pre-loaded with implementations for common models, including Multivariate Gaussians, Categorical distributions, and Positive Semi-definite (PSD) matrix cones. Its utility is showcased through several "visual vignettes":
Centroid Computation
pyBregMan successfully calculates and visualizes different types of centroids. The following figure demonstrates the computation of Left-KL, Right-KL, Bhattacharyya, and Fisher-Rao centroids for bivariate Gaussians.
Matrix Means and Information Theory
- PSD Matrices: The library demonstrates the convergence of the inductive arithmetic-harmonic mean (AHM) algorithm, which converges quadratically to the geometric mean of PSD matrices.
- Chernoff Information: It provides a clean implementation for finding the Chernoff point on a 1D Gaussian manifold.
- Image Histograms: Jensen-Shannon and Jeffreys centroids were computed for pixel intensity histograms from source images to demonstrate operations on categorical manifolds.
Discussion and Limitations
While powerful, pyBregMan has areas for growth. For high-precision applications, users are encouraged to provide explicit analytical derivatives to avoid the numerical overhead of autograd. Additionally, visualization tools are currently optimized for 2D and 3D projections, and some geometric objects like the Ball class have limited functionality beyond membership testing.
Conclusion
By providing a robust geometric kernel, pyBregMan bridges the gap between theoretical information geometry and practical code. It enables researchers to focus on high-level statistical modeling rather than low-level geometric implementation.
Summary updated