Closed fariquelme closed 5 years ago
Hi,
I used emd
and the distance matrix was calculated to reflect euclidean distance. I simply created a NxN
matrix as in the following:
distance_matrix = np.zeros((N**2,N**2))
for x1 in range(N):
for y1 in range(N):
for x2 in range(N):
for y2 in range(N):
d = distance_fnc((x1, y1), (x2,y2))
X = x1*N + y1
Y = x2*N + y2
distance_matrix[X,Y] = d
assert np.sum(distance_matrix - distance_matrix.T) == 0 #distance matrix should be symmetric
The distance_fnc
in the code snippet computes the euclidean distance between the two points, but you can change it into any metric you want (i.e. manhattan, squared, etc.).
Thanks, i will try to replicate the results!
Hello Seth, I am using
pyemd
as you posted, but I have some doubts about the EMD calculation. Did you useemd
oremd_samples
?. If it isemd
, what distance matrix did you use?, and if it isemd_samples
, how many bins ?Thanks!