ott.tools.sinkhorn_divergence.sinkhorn_divergence#
- ott.tools.sinkhorn_divergence.sinkhorn_divergence(geom, *args, a=None, b=None, solve_kwargs=mappingproxy({}), static_b=False, offset_static_b=None, share_epsilon=True, symmetric_sinkhorn=True, **kwargs)[source]#
Compute Sinkhorn divergence between two measures.
The Sinkhorn divergence is computed between two measures \(\mu\) and \(\nu\) by specifying three
Geometry
objects, each describing pairwise costs within points in \(\mu,\nu\), \(\mu,\mu\), and \(\nu,\nu\).This implementation proposes the most general interface, to generate those three geometries by specifying first the type of
Geometry
that is used to compare them, followed by the arguments used to generate these threeGeometry
instances through its correspondingprepare_divergences()
method.- Parameters:
args (
Any
) – Positional arguments toprepare_divergences()
that are specific to each geometry.solve_kwargs (
Mapping
[str
,Any
]) – keywords arguments forsolve()
that is called either twice ifstatic_b == True
or three times whenstatic_b == False
.static_b (
bool
) – ifTrue
, divergence of the second measure (with weightsb
) to itself is not recomputed.offset_static_b (
Optional
[float
]) – whenstatic_b
isTrue
, use that value to offset computation. Useful when the value of the divergence of the second measure to itself is precomputed and not expected to change.share_epsilon (
bool
) – if True, enforces that the same epsilon regularizer is shared for all 2 or 3 terms of the Sinkhorn divergence. In that case, the epsilon will be by default that used when comparing x to y (contained in the first geometry). This flag is set to True by default, because in the default setting, the epsilon regularization is a function of the std of the entries in the cost matrix.symmetric_sinkhorn (
bool
) – Use Sinkhorn updates in Eq. 25 of [Feydy et al., 2019] for symmetric terms comparing x/x and y/y.kwargs (
Any
) – keywords arguments to the generic class. This is specific to each geometry.
- Return type:
- Returns:
The Sinkhorn divergence value, and output object detailing computations.