Skip to content

Optimal Transport Distance value in domain adaptation #645

Answered by rflamary
XLoizeau asked this question in Q&A
Discussion options

You must be logged in to vote

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 ot.solve function that returns a class containing the OT plan ot.solve(...).plan ad the value ot.solve(...).value

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@XLoizeau
Comment options

Answer selected by XLoizeau
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants