ott.solvers.linear.sinkhorn.SinkhornOutput#
- class ott.solvers.linear.sinkhorn.SinkhornOutput(potentials, errors=None, reg_ot_cost=None, ot_prob=None, threshold=None, converged=None, inner_iterations=None)[source]#
Holds the output of a Sinkhorn solver applied to a problem.
Objects of this class contain both solutions and problem definition of a regularized OT problem, along several methods that can be used to access its content, to, for instance, materialize an OT matrix or apply it to a vector (without having to materialize it when not needed).
- Parameters:
potentials (
Tuple[Array,...]) – list of optimal dual variables, two vector of sizeot.prob.shape[0]andot.prob.shape[1]returned by Sinkhornerrors (
Optional[Array]) – vector or errors, along iterations. This vector is of sizemax_iterations // inner_iterationswhere those were the parameters passed on to theSinkhornsolver. For each entry indexed ati,errors[i]can be either a real non-negative value (meaning the algorithm recorded that error at thei * inner_iterationsiteration), ajnp.infvalue (meaning the algorithm computed that iteration but did not compute its error, because, for instance,i < min_iterations // inner_iterations), or a-1, meaning that execution was terminated before that iteration, because the criterion was found to be smaller thanthreshold.reg_ot_cost (
Optional[Array]) – the regularized optimal transport cost. By default this is the linear contribution + KL term. Seeent_reg_cost,primal_costanddual_costfor other objective values.ot_prob (
Optional[LinearProblem]) – stores the definition of the OT problem, including geometry, marginals, unbalanced regularizers, etc.threshold (
Optional[Array]) – convergence threshold used to control the termination of the algorithm.converged (
Optional[bool]) – whether the output corresponds to a solution whose error is below the convergence threshold.inner_iterations (
Optional[int]) – number of iterations that were run between two computations of errors.
Methods
apply(inputs[, axis, lse_mode])Apply the transport to a ndarray; axis=1 for its transpose.
cost_at_geom(other_geom)Return reg-OT cost for matrix, evaluated at other cost matrix.
count(value, /)Return number of occurrences of value.
index(value[, start, stop])Return first index of value.
marginal(axis)set(**kwargs)Return a copy of self, with potential overwrites.
set_cost(ot_prob, lse_mode, use_danskin)to_dual_potentials([epsilon])Compute dual potential functions.
transport_cost_at_geom(other_geom)Return bare transport cost of current solution at any geometry.
Attributes
Alias for field number 5
Diagonal of the transport matrix.
Return dual transport cost, without considering regularizer.
Entropy regularized cost.
Entropy of the coupling.
Alias for field number 1
The first dual potential.
The second dual potential.
Alias for field number 6
KL regularized OT transport cost.
Transport matrix if it can be instantiated.
Returns the total number of iterations that were needed to terminate.
Renormalized entropy of coupling when the problem is assignment.
Alias for field number 3
Alias for field number 0
Return transport cost of current transport solution at geometry.
Alias for field number 2
Alias for field number 4
Sum of transport matrix.