distances: Pairwise Distance Matrix Computation
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"), verbose = TRUE)
pdist2(x, y, method = c("cosine", "euclidean", "jaccard"), norm = c("l2",
"l1", "none"), verbose = TRUE)
second matrix. For
y = NULL set by default.
This means that we will assume
y = x and calculate distances/similarities between all rows of the
character or instance of
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
logical whether to display additional information during calculations
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.
matrix of distances/similarities between each row of
x and each row of matrix
vector of "parallel" distances between rows