On Thu, May 31, 2012 at 12:36 AM, Pat Ferrel <pat@occamsmachete.com> wrote:
> I see
> double denominator = Math.sqrt(lengthSquaredp1) *
> Math.sqrt(lengthSquaredp2);
> // correct for floatingpoint rounding errors
> if (denominator < dotProduct) {
> denominator = dotProduct;
> }
> return 1.0  dotProduct / denominator;
>
> So this is going to return 1  cosine, right? So for clustering the
> distance 1 = very close, 0 = very far.
>
>
When two vectors are close, the angle between them is small, so the cosine
is large, near 1. 0 = close, 1 = far, as expected.
