MCPcopy Create free account
hub / github.com/PythonOT/POT / get_plan_from_dual

Function get_plan_from_dual

ot/smooth.py:453–473  ·  view source on GitHub ↗

r""" Retrieve optimal transportation plan from optimal dual potentials. Parameters ---------- alpha: array, shape = len(a) beta: array, shape = len(b) Optimal dual potentials. C: array, shape = (len(a), len(b)) Ground cost matrix. regul: Regularization ob

(alpha, beta, C, regul)

Source from the content-addressed store, hash-verified

451
452
453def get_plan_from_dual(alpha, beta, C, regul):
454 r"""
455 Retrieve optimal transportation plan from optimal dual potentials.
456
457 Parameters
458 ----------
459 alpha: array, shape = len(a)
460 beta: array, shape = len(b)
461 Optimal dual potentials.
462 C: array, shape = (len(a), len(b))
463 Ground cost matrix.
464 regul: Regularization object
465 Should implement a `delta_Omega(X)` method.
466
467 Returns
468 -------
469 T: array, shape = (len(a), len(b))
470 Optimal transportation plan.
471 """
472 X = alpha[:, np.newaxis] + beta - C
473 return regul.delta_Omega(X)[1]
474
475
476def get_plan_from_semi_dual(alpha, b, C, regul):

Callers 1

smooth_ot_dualFunction · 0.85

Calls 1

delta_OmegaMethod · 0.45

Tested by

no test coverage detected