cosine
Syntax
cosine(X, Y)
Details
Compute the cosine similarity between X and Y. The cosine similarity between X and Y, is defined as (X · Y) / (||X|| × ||Y||).
Parameters
X and Y are numeric vectors with the same number of elements.
Returns
A DOUBLE scalar.
Examples
x = [1, 2, 3]
y = [4, 5, 6]
cosine(x, y);
// output: 0.9746318
Related functions: euclidean, minkowski, seuclidean, mahalanobis
