metrics.pairwise.word_movers_distance¶
-
pai4sk.metrics.pairwise.
word_movers_distance
(W, X, Y=None, use_gpu=True)¶ Computes word movers distance between samples in X and Y.
The details of the approximation algorithm can be found here: “http://export.arxiv.org/abs/1812.02091”.
Parameters: - W (ndarray, shape: (n_features, n_dimensions)) – Embedding vectors
- 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
.
Returns: D – Word Movers Distance
Return type: array-like, shape (n_samples_x, n_samples_y)