atharv1205 commented on PR #789:
URL: https://github.com/apache/commons-text/pull/789#issuecomment-6765992707

   Thanks @agammann, good point. Only the upper bound is clamped, so negative 
similarities are kept. I renamed the range test to 
`testCosineSimilarityOfNonNegativeVectorsIsInRange` and added 
`testCosineSimilarityOfSignedVectors`, which checks that `{x=1}` vs `{x=-1}` is 
exactly -1.0, that a vector vs its negation is -1.0, and that opposite-signed 
vectors stay within [-1.0, 0.0]. I also updated the description to say [0, 1] 
holds only for non-negative vectors.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to