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

Function ewca

ot/dr.py:426–594  ·  view source on GitHub ↗

r""" Entropic Wasserstein Component Analysis :ref:`[52] `. The function solves the following optimization problem: .. math:: \mathbf{U} = \mathop{\arg \min}_\mathbf{U} \quad W(\mathbf{X}, \mathbf{U}\mathbf{U}^T \mathbf

(
    X,
    U0=None,
    reg=1,
    k=2,
    method="BCD",
    sinkhorn_method="sinkhorn",
    stopThr=1e-6,
    maxiter=100,
    maxiter_sink=1000,
    maxiter_MM=10,
    verbose=0,
)

Source from the content-addressed store, hash-verified

424
425
426def ewca(
427 X,
428 U0=None,
429 reg=1,
430 k=2,
431 method="BCD",
432 sinkhorn_method="sinkhorn",
433 stopThr=1e-6,
434 maxiter=100,
435 maxiter_sink=1000,
436 maxiter_MM=10,
437 verbose=0,
438):
439 r"""
440 Entropic Wasserstein Component Analysis :ref:`[52] <references-entropic-wasserstein-component_analysis>`.
441
442 The function solves the following optimization problem:
443
444 .. math::
445 \mathbf{U} = \mathop{\arg \min}_\mathbf{U} \quad
446 W(\mathbf{X}, \mathbf{U}\mathbf{U}^T \mathbf{X})
447
448 where :
449
450 - :math:`\mathbf{U}` is a matrix in the Stiefel(`p`, `d`) manifold
451 - :math:`W` is entropic regularized Wasserstein distances
452 - :math:`\mathbf{X}` are samples
453
454 Parameters
455 ----------
456 X : ndarray, shape (n, d)
457 Samples from measure :math:`\mu`.
458 U0 : ndarray, shape (d, k), optional
459 Initial starting point for projection.
460 reg : float, optional
461 Regularization term >0 (entropic regularization).
462 k : int, optional
463 Subspace dimension.
464 method : str, optional
465 Eather 'BCD' or 'MM' (Block Coordinate Descent or Majorization-Minimization).
466 Prefer MM when d is large.
467 sinkhorn_method : str
468 Method used for the Sinkhorn solver, see :ref:`ot.bregman.sinkhorn` for more details.
469 stopThr : float, optional
470 Stop threshold on error (>0).
471 maxiter : int, optional
472 Maximum number of iterations of the BCD/MM.
473 maxiter_sink : int, optional
474 Maximum number of iterations of the Sinkhorn solver.
475 maxiter_MM : int, optional
476 Maximum number of iterations of the MM (only used when method='MM').
477 verbose : int, optional
478 Print information along iterations.
479
480 Returns
481 -------
482 pi : ndarray, shape (n, n)
483 Optimal transportation matrix for the given parameters.

Callers 1

plot_EWCA.pyFile · 0.90

Calls 8

compute_lossFunction · 0.85
grassmann_distanceFunction · 0.85
meanMethod · 0.45
fitMethod · 0.45
onesMethod · 0.45
eyeMethod · 0.45
eighMethod · 0.45
qrMethod · 0.45

Tested by

no test coverage detected