dist2 calculates pairwise distances/similarities between the
rows of two data matrices. Note that some methods work only on sparse matrices and
others work only on dense matrices.
pdist2 calculates "parallel" distances between the rows of two data matrices.
dist2(x, y = NULL, method = c("cosine", "euclidean", "jaccard"),
norm = c("l2", "l1", "none"))pdist2(x, y, method = c("cosine", "euclidean", "jaccard"),
norm = c("l2", "l1", "none"))
dist2 returns matrix of distances/similarities between each row of
matrix x and each row of matrix y.
pdist2 returns vector of "parallel" distances between rows
of x and y.
first matrix.
second matrix. For dist2 y = NULL set by default.
This means that we will assume y = x and calculate distances/similarities between all rows of the x.
usually character or instance of tet2vec_distance class.
The distances/similarity measure to be used. One of c("cosine", "euclidean", "jaccard") or RWMD.
RWMD works only on bag-of-words matrices.
In case of "cosine" distance max distance will be 1 - (-1) = 2
character = c("l2", "l1", "none") - how to scale input matrices.
If they already scaled - use "none"
Computes the distance matrix computed by using the specified method. Similar to dist function, but works with two matrices.
pdist2 takes two matrices and return a single vector.
giving the ‘parallel’ distances of the vectors.