earth-movers-distance

Python Earth Mover Distance of 2D arrays

情到浓时终转凉″ 提交于 2020-02-22 15:33:40
问题 I would like to compute the Earth Mover Distance between two 2D arrays (these are not images). Right now I go through two libraries: scipy (https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.wasserstein_distance.html) and pyemd (https://pypi.org/project/pyemd/). #define a sampeling method def sampeling2D(n, mu1, std1, mu2, std2): #sample from N(0, 1) in the 2D hyperspace x = np.random.randn(n, 2) #scale N(0, 1) -> N(mu, std) x[:,0] = (x[:,0]*std1) + mu1 x[:,1] = (x[:,1]*std2) +