cosineDist: Cosine Distance

View source: R/matrixFunctions.R

cosineDistR Documentation

Cosine Distance

Description

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.)

Usage

cosineDist(x, y)

Arguments

x

A matrix, VectorSpaceModel, or vector.

y

A matrix, VectorSpaceModel, or vector.

Value

A matrix whose dimnames are rownames(x), rownames(y) and whose entires are the associated distance.


bmschmidt/wordVectors documentation built on June 2, 2022, 3:53 p.m.