Description Usage Arguments Details Value Source
This function calculates the cosine similarity matrix between all
rows of a matrix x. When x and y are vectors
it calculates the cosine similarity between them. When x
is a vector and y is a matrix it calculates the cosine
between x and each row of y.
1 | cbn_cosine(x, y = NULL)
|
x |
A vector or a matrix (e.g., a document-term matrix). |
y |
A vector with compatible dimensions to x. If NULL, use all columns of |
This code is taken directly from the lsa package but adjusted to
operate rowwise.
An ncol(x) by ncol(x) matrix of cosine similarities, a scalar
cosine similarity, or a vector of cosine simialrities of length nrow(y).
The original code is from the cosine function by
Fridolin Wild (f.wild@open.ac.uk) in the lsa package.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.