Code from CosineDistanceMeasure
// correct for zero-vector corner case
if (denominator == 0 && dotProduct == 0) {
return 1;
}
Seems like a bug to me, agree with Dan it should be 0 (and not 1).
________________________________
From: Dan Filimon <[email protected]>
To: [email protected]
Sent: Thursday, April 4, 2013 2:42 PM
Subject: CosineDistanceMeasure for 2 zero vectors?
In the case where both vectors are all zeros, the angle between them is 0,
so the cosine is therefore 1 and the so the distance returned should be 0
(unless I misunderstood what the distance does).
In Mahout, when calling distance() however, if both the denominator and
dotProduct are 0 (which is true when both vectors are 0), the returned
value is 1.
This looks like a bug to me and I would open a JIRA issue and fix it but I
want to make sure there's nothing I could possibly be missing.
Thoughts?