ott.geometry.costs.Arccos

Contents

ott.geometry.costs.Arccos#

class ott.geometry.costs.Arccos(n, ridge=1e-08)[source]#

Arc-cosine cost function [Cho and Saul, 2009].

The cost is implemented as:

\[c_n(x, y) = -\log(\frac{1}{\pi} \|x\|^n \|y\|^n J_n(\theta))\]

where \(\theta := \arccos(\frac{x \cdot y}{\|x\| \|y\|})\) and \(J_n(\theta) := (-1)^n (\sin \theta)^{2n + 1} (\frac{1}{\sin \theta}\frac{\partial}{\partial \theta})^n (\frac{\pi - \theta}{\sin \theta})\).

Parameters:
  • n (int) – Order of the kernel. For \(n > 2\), successive applications of grad() are used to compute the \(J_n(\theta)\).

  • ridge (float) – Ridge regularization.

Methods

all_pairs(x, y)

Compute matrix of all pairwise costs, including the norms.

all_pairs_pairwise(x, y)

Compute matrix of all pairwise costs, excluding the norms.

barycenter(weights, xs)

Barycentric operator.

pairwise(x, y)

Compute cost between \(x\) and \(y\).

twist_operator(vec, dual_vec, variable)

Twist inverse operator of the cost function.

Attributes

norm