-
Hello, Basing myself on this example from the official gallery I was a bit surprised to see that the distance is not returned plainly. After a bit of digging around, I saw that when using the Earth Movers distance as follows: ot_emd = ot.da.EMDTransport()
ot_emd.fit(Xs = Xs, Xt = Xt)
transp_Xs_emd = ot_emd.transform(Xs = X1) the distance seems to be stored in the log_ attribute of When it comes to the other distances (sinkhorn and mapping transport) demonstrated in this example, I could not find the distance at all. Would anyone be able to tell me if I am missing something and if there is a reason for those quantities not to be returned? Thank you so much for your help. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The OT distance is returned by function ot.emd2 same with sinkhorn # a,b are 1D histograms (sum to 1 and positive)
# M is the ground cost matrix
Wd = ot.emd2(a, b, M) # exact linear program
Wd_reg = ot.sinkhorn2(a, b, M, reg) # entropic regularized OT
# if b is a matrix compute all distances to a and return a vector Or we have the more recent |
Beta Was this translation helpful? Give feedback.
The OT distance is returned by function ot.emd2 same with sinkhorn
Or we have the more recent
ot.solve
function that returns a class containing the OT planot.solve(...).plan
ad the valueot.solve(...).value