metrics.pairwise.earth_movers_distance¶
-
pai4sk.metrics.pairwise.
earth_movers_distance
(D_ground, X, Y=None, use_gpu=True, optimization_level=1, num_cpu_threads=None)¶ Computes Earth Mover’s Distance between samples in X and Y given ground distances D_ground.
The details of the approximation algorithm can be found here: “http://export.arxiv.org/abs/1812.02091”.
- Parameters
D_ground (ndarray, shape: (n_features, n_features)) – Ground distances
X (array-like, sparse-matrix, shape (n_samples_x, n_features)) – Input dataset. When MPI is used, it is preferred to have X of larger size than Y when X and Y are of unequal sizes as the MPI distribution of data is performed for X only.
Y (array-like, sparse-matrix, shape (n_samples_y, n_features), optional) – Input dataset. If
None
, the output will be the pairwise similarities between all samples inX
.use_gpu (boolean, when false uses the CPU, when true uses the GPU.) –
optimization_level (integer, mimimum is 0 and maximum is 4. Using a higher value increases runtime.) –
num_cpu_threads (integer, maximum number of CPU threads used by each process.) –
- Returns
D – Earth Movers Distance
- Return type
array-like, shape (n_samples_x, n_samples_y)