Skip to content Skip to sidebar Skip to footer

How To Extract The Distance And Transport Matrices From Scipy's Wasserstein_distance?

The scipy.stats.wasserstein_distance function only returns the minimum distance (the solution) between two input distributions, p and q. But that distance is the result of the prod

Solution 1:

It does not seem that you can get the calculated transport matrix from scipy's wasserstein_distance. You can get it via other packages though, like https://github.com/wmayner/pyemd. I have been using this package for a while and it works pretty fine, while also executing very quickly. Look into the function emd_with_flow() within section Usage.

Then the distance matrix is an input of the EMD calculation, not an output.

Post a Comment for "How To Extract The Distance And Transport Matrices From Scipy's Wasserstein_distance?"