View source: R/matrixFunctions.R
cosineDist | R Documentation |
Calculate the cosine distance between two vectors.
Not an actual distance metric, but can be used in similar contexts. It is calculated as simply the inverse of cosine similarity, and falls in a fixed range of 0 (identical) to 2 (completely opposite in direction.)
cosineDist(x, y)
x |
A matrix, VectorSpaceModel, or vector. |
y |
A matrix, VectorSpaceModel, or vector. |
A matrix whose dimnames are rownames(x), rownames(y) and whose entires are the associated distance.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.