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

Function joint_OT_mapping_kernel

ot/mapping.py:646–894  ·  view source on GitHub ↗

r"""Joint OT and nonlinear mapping estimation with kernels as proposed in :ref:`[8] `. The function solves the following optimization problem: .. math:: \min_{\gamma, L\in\mathcal{H}}\quad \|L(\mathbf{X_s}) - n_s\gamma \mathbf{X_t}\|^

(
    xs,
    xt,
    mu=1,
    eta=0.001,
    kerneltype="gaussian",
    sigma=1,
    bias=False,
    verbose=False,
    verbose2=False,
    numItermax=100,
    numInnerItermax=10,
    stopInnerThr=1e-6,
    stopThr=1e-5,
    log=False,
    **kwargs,
)

Source from the content-addressed store, hash-verified

644
645
646def joint_OT_mapping_kernel(
647 xs,
648 xt,
649 mu=1,
650 eta=0.001,
651 kerneltype="gaussian",
652 sigma=1,
653 bias=False,
654 verbose=False,
655 verbose2=False,
656 numItermax=100,
657 numInnerItermax=10,
658 stopInnerThr=1e-6,
659 stopThr=1e-5,
660 log=False,
661 **kwargs,
662):
663 r"""Joint OT and nonlinear mapping estimation with kernels as proposed in
664 :ref:`[8] <references-joint-OT-mapping-kernel>`.
665
666 The function solves the following optimization problem:
667
668 .. math::
669 \min_{\gamma, L\in\mathcal{H}}\quad \|L(\mathbf{X_s}) -
670 n_s\gamma \mathbf{X_t}\|^2_F + \mu \langle \gamma, \mathbf{M} \rangle_F +
671 \eta \|L\|^2_\mathcal{H}
672
673 s.t. \ \gamma \mathbf{1} = \mathbf{a}
674
675 \gamma^T \mathbf{1} = \mathbf{b}
676
677 \gamma \geq 0
678
679
680 where :
681
682 - :math:`\mathbf{M}` is the (`ns`, `nt`) squared euclidean cost matrix between samples in
683 :math:`\mathbf{X_s}` and :math:`\mathbf{X_t}` (scaled by :math:`n_s`)
684 - :math:`L` is a :math:`n_s \times d` linear operator on a kernel matrix that
685 approximates the barycentric mapping
686 - :math:`\mathbf{a}` and :math:`\mathbf{b}` are uniform source and target weights
687
688 The problem consist in solving jointly an optimal transport matrix
689 :math:`\gamma` and the nonlinear mapping that fits the barycentric mapping
690 :math:`n_s\gamma \mathbf{X_t}`.
691
692 One can also estimate a mapping with constant bias (see supplementary
693 material of :ref:`[8] <references-joint-OT-mapping-kernel>`) using the bias optional argument.
694
695 The algorithm used for solving the problem is the block coordinate
696 descent that alternates between updates of :math:`\mathbf{G}` (using conditional gradient)
697 and the update of :math:`\mathbf{L}` using a classical kernel least square solver.
698
699
700 Parameters
701 ----------
702 xs : array-like (ns,d)
703 samples in the source domain

Callers 1

fitMethod · 0.85

Calls 13

list_to_arrayFunction · 0.85
get_backendFunction · 0.85
kernelFunction · 0.85
unifFunction · 0.85
emdFunction · 0.85
solve_LFunction · 0.85
solve_GFunction · 0.85
distFunction · 0.70
lossFunction · 0.70
concatenateMethod · 0.45
onesMethod · 0.45
eyeMethod · 0.45

Tested by

no test coverage detected