blob: 48b153243257f33217f7309f5f98cb29039b0f87 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
How to ?
========
In the following we provide some pointers about which functions and classes
to use for different problems related to optimal transport (OTs).
1. **How to solve a discrete optimal transport problem ?**
The solver for discrete is the function :py:mod:`ot.emd` that returns
the OT transport matrix. If you want to solve a regularized OT you can
use :py:mod:`ot.sinkhorn`.
More detailed examples can be seen on this :ref:`auto_examples/plot_OT_2D_samples`
Here is a simple use case:
.. code:: python
# a,b are 1D histograms (sum to 1 and positive)
# M is the ground cost matrix
T=ot.emd(a,b,M) # exact linear program
T_reg=ot.sinkhorn(a,b,M,reg) # entropic regularized OT
|