wmayner / pyemd

Fast EMD for Python: a wrapper for Pele and Werman's C++ implementation of the Earth Mover's Distance metric

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing control of the input vectors

pajola opened this issue · comments

commented

I was running the function imd_sample and I've noticed that the function returns a result even when the arrays are not 1D.

The arrays don't actually need to be 1D, since they're interpreted as a bunch of samples that are converted into a histogram; the behavior for multidimensional arrays is inherited from np.histogram. We should remove the "1D" description from the docstring.

commented

But the function of numpy histogram is flatting the array, isn't this a problem?
https://docs.scipy.org/doc/numpy/reference/generated/numpy.histogram.html

No, it isn't a problem. The purpose of the function is to compute a histogram on two sets of samples and then measure the distance between the histograms with the EMD, so the shape of the array that the samples are stored in should not matter.