ott.geometry.costs.CostFn
ott.geometry.costs.CostFn#
- class ott.geometry.costs.CostFn[source]#
A generic cost function, taking two vectors as input.
Cost functions evaluate a function on a pair of inputs. For convenience, that function is split into two norms – evaluated on each input separately – followed by a pairwise cost that involves both inputs, as in:
c(x,y) = norm(x) + norm(y) + pairwise(x,y)
If the
norm
function is not implemented, that value is handled as a 0, and onlypairwise
is used.Methods
all_pairs
(x, y)Compute matrix of all costs (including norms) for vectors in x / y.
all_pairs_pairwise
(x, y)Compute matrix of all pairwise-costs (no norms) for vectors in x / y.
barycenter
(weights, xs)Barycentric operator.
pairwise
(x, y)- rtype
Array
Attributes