bregman.dissimilarity package
Submodules
bregman.dissimilarity.base module
- class bregman.dissimilarity.base.ApproxDissimilarity(manifold: TBregmanManifold)
Bases:
Dissimilarity[TBregmanManifold],Generic[TBregmanManifold]Abstract class for approximate dissimilarity functions defined on Bregman manifolds. Primary different between this class and Dissimilarity is that the dissimilarity function calculated are approximate and have an addition precision parameters eps.
- abstract dissimilarity(point_1: Point, point_2: Point, eps: float = 1e-05) ndarray
Calculate the approximate dissimilarity between two points.
- Parameters:
point_1 – Left-sided argument of the dissimilarity function.
point_2 – Right-sided argument of the dissimilarity function.
eps – Precision of dissimilarity calculation.
- Returns:
Dissimilarity with precision eps between point_1 and point_2.
- class bregman.dissimilarity.base.Dissimilarity(manifold: TBregmanManifold)
Bases:
Generic[TBregmanManifold],ABCAbstract class for dissimilarity functions defined on Bregman manifolds.
- Parameters:
manifold – Bregman manifold which the dissimilarity function is defined on.
bregman.dissimilarity.bregman module
- class bregman.dissimilarity.bregman.BregmanDivergence(manifold: BregmanManifold, dcoords: DualCoords = DualCoords.THETA)
Bases:
DualDissimilarityBregman divergence for points on a Bregman manifold.
- dissimilarity(point_1: Point, point_2: Point) ndarray
Bregman divergence between two points.
\[B_{F}(p_1 : p_2) = F(p_1) - F(p_2) - \langle \nabla F(p_2), p_1 - p_2 \rangle.\]- Parameters:
point_1 – Left-sided argument of the Bregman divergence.
point_2 – Right-sided argument of the Bregman divergence.
- Returns:
Bregman divergence between point_1 and point_2.
- class bregman.dissimilarity.bregman.ChernoffInformation(manifold: BregmanManifold, dcoords: DualCoords = DualCoords.THETA)
Bases:
DualApproxDissimilarityChernoff Information. This is the Chernoff point evaluated at the skew Burea-Rao divergence.
https://www.mdpi.com/1099-4300/24/10/1400
- chernoff_point(point_1: Point, point_2: Point, eps: float = 1e-05) float
Finds the Chernoff point: the skew value which we will evaluate the Burea-Rao divergence to obtain the Chernoff information. This corresponds to the \(\alpha\) value which maximizes the Burea-Rao divergence between two points.
The Chernoff point can be characterized as a function of the interpolating parameter which makes the divergence between point_1 and point_2.
This function approximates the Chernoff point in this way through bisection search.
- Parameters:
point_1 – Left-sided argument of the Chernoff information.
point_2 – Right-sided argument of the Chernoff information.
eps – Error difference between point_1 and point_2’s divergence of the interpolating point.
- Returns:
An approximate Chernoff point.
- dissimilarity(point_1: Point, point_2: Point, eps: float = 1e-05) ndarray
Calculate the Chernoff information via an approximate Chernoff point.
\[\mathrm{CI}(p_1 : p_2) = \max_{\alpha \in (0, 1)} \mathrm{sBR}_{\alpha}(p_1 : p_2),\]where \(\mathrm{sBR}_{\alpha}(p_1 : p_2)\) is the skewed Burea-Rao divergence. The optimal \(\alpha^\star\) corresponds to the Chernoff point.
- Parameters:
point_1 – Left-sided argument of the Chernoff information.
point_2 – Right-sided argument of the Chernoff information.
eps – Error tolerance for Chernoff point bisection search approximation.
- Returns:
Approximate Chernoff information between point_1 and point_2 with eps error tolerance.
- class bregman.dissimilarity.bregman.DualApproxDissimilarity(manifold: BregmanManifold, dcoords: DualCoords = DualCoords.THETA)
Bases:
ApproxDissimilarity[BregmanManifold]Approximate dissimilarity function based on the dual coordinates of Bregman manifolds.
- Parameters:
coord – Dual coordinates for the dissimilarity function.
- class bregman.dissimilarity.bregman.DualDissimilarity(manifold: BregmanManifold, dcoords: DualCoords = DualCoords.THETA)
Bases:
Dissimilarity[BregmanManifold]Dissimilarity functions based on the dual coordinates of Bregman manifolds.
- Parameters:
coord – Dual coordinates for the dissimilarity function.
- class bregman.dissimilarity.bregman.JeffreysDivergence(manifold: BregmanManifold)
Bases:
Dissimilarity[BregmanManifold]Jeffreys divergence on the Bregman manifold.
- Parameters:
theta_divergence – Bregman divergence using \(\theta\) generator.
eta_divergence – Bregman divergence using \(\eta\) generator.
- dissimilarity(point_1: Point, point_2: Point) ndarray
Jeffreys divergence between two points.
\[\mathrm{Jef}(p_1 : p_2) = B_{F}(p_1 : p_2) + B_{F^*}(p_1 : p_2).\]- Parameters:
point_1 – Left-sided argument of the Jeffreys divergence.
point_2 – Right-sided argument of the Jeffreys divergence.
- Returns:
Jeffreys divergence between point_1 and point_2.
- class bregman.dissimilarity.bregman.SkewBurbeaRaoDivergence(manifold: BregmanManifold, alpha: float, dcoords: DualCoords = DualCoords.THETA)
Bases:
DualDissimilaritySkewed Burbea-Rao Divergence on Bregman manifolds. Equivalent to the Bhattacharyya divergence when the Bregman manifold is an exponential family manifold.
https://arxiv.org/pdf/1004.5049
- Parameters:
alpha – \(\alpha\)-skew of the Burbea-Rao divergence.
- dissimilarity(point_1: Point, point_2: Point) ndarray
Skewed Burbea-Rao divergence between two points.
\[\mathrm{sBR}_{\alpha}(p_1 : p_2) = \frac{1}{\alpha(1-\alpha)} \left( \alpha F(p_1) + (1-\alpha)F(p_2) - F(\alpha \cdot p_1 + (1-\alpha) \cdot p_2) \right).\]Note the ordering of interpolation which is different form the typical usage (see skew Jensen-Bregman divergence).
- Parameters:
point_1 – Left-sided argument of the skewed Burbea-Rao divergence.
point_2 – Right-sided argument of the skewed Burbea-Rao divergence.
- Returns:
Skewed Burbea-Rao divergence between point_1 and point_2.
- class bregman.dissimilarity.bregman.SkewJensenBregmanDivergence(manifold: BregmanManifold, alpha_skews: list[float], weight_skews: list[float], dcoords: DualCoords = DualCoords.THETA)
Bases:
DualDissimilaritySkewed Jensen-Bregman Divergence.
https://arxiv.org/pdf/1912.00610
- Parameters:
alpha_skews – Interpolation parameter for the mean point.
weight_skews – Weights on individual divergence terms.
alpha_mid – Weighted mean point.
- dissimilarity(point_1: Point, point_2: Point) ndarray
Skewed Jensen-Bregman divergence between two points.
\[\mathrm{JBD}(p_1 : p_2) = \sum_{i=1}^k w_i \cdot B_{F}((p_1 p_2)_{\alpha_i} : (p_1 p_2)_{\bar{\alpha}}),\]where
\[\bar{\alpha} = \frac{1}{k} \sum_{i=1}^k \alpha_i\]and
\[(p_1 p_2)_{\alpha} = (1-\alpha) \cdot p_1 + \alpha \cdot p_2.\]- Parameters:
point_1 – Left-sided argument of the skewed Jensen-Bregman divergence.
point_2 – Right-sided argument of the skewed Jensen-Bregman divergence.
- Returns:
Skewed Jensen-Bregman divergence between point_1 and point_2.