1

I'm using Mahout's CosineDistanceMeasure class in order to calculate the distance between vectors, represented as DenseVectors.

DenseVector vector1 = ... //initialized to some values
DenseVector vector2 = ... //initialized to some values
CosineDistanceMeasure cos = new CosineDistanceMeasure();
cos.distance(vector1, vector2);

Now, for some couples of vectors, the method distance() returns values bigger than 1, while I thought cosine distance was supposed to be included between 0 and 1.

Can anybody explain this behaviour?

Thank you in advance!

Luca P.
  • 63
  • 7

0 Answers0