Open mglisse opened 3 years ago
The problem seems to be in POT, likely a numerical issue due to the very large coordinates of the 4th point.
import numpy as np
import ot
M = np.array(
[
[2.50275352e02, 3.74653218e02, 2.41352736e03, 1.00000000e32, 1.51751540e-03],
[2.13082030e02, 3.28812836e02, 2.29487946e03, 1.00000000e32, 1.37109800e-01],
[1.97333083e02, 3.09175848e02, 2.24250550e03, 1.00000000e32, 2.46506283e00],
[1.00000000e32, 1.00000000e32, 1.00000000e32, 5.26223432e00, 2.50000000e31],
[3.84690152e01, 8.09465684e01, 3.33064175e02, 2.50000000e31, 0.00000000e00],
]
)
a = np.array([0.125, 0.125, 0.125, 0.125, 0.5])
b = np.array([0.125, 0.125, 0.125, 0.125, 0.5])
P = ot.emd(a=a, b=b, M=M, numItermax=2000000)
Q = np.array(
[
[0, 0, 0, 0, 0.125],
[0, 0, 0, 0, 0.125],
[0, 0, 0, 0, 0.125],
[0, 0, 0, 0.125, 0],
[0.125, 0.125, 0.125, 0, 0.125],
]
)
assert (P.sum(axis=0) == a).all()
assert (P.sum(axis=1) == a).all()
assert (Q.sum(axis=0) == a).all()
assert (Q.sum(axis=1) == a).all()
print(np.sum(np.multiply(P, M)))
print(np.sum(np.multiply(Q, M)))
Ok I could reproduce the issue with your mwe. What should we do, forward this to POT? In your initial example, were the points with 1e16 coordinates representing ``essential'' parts ?
forward this to POT?
I think so, although there is a small chance they may consider it "normal".
We sometimes get wildly different results with POT and hera
It looks like the first one did not match any point with the diagonal, whereas it seems better to match the first 3 points of each diagram to the diagonal.