Class CosineSimilarity


  • public class CosineSimilarity
    extends java.lang.Object
    Measures the Cosine similarity of two vectors of an inner product space and compares the angle between them.

    For further explanation about the Cosine Similarity, refer to http://en.wikipedia.org/wiki/Cosine_similarity.

    Since:
    1.0
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Double cosineSimilarity​(java.util.Map<java.lang.CharSequence,​java.lang.Integer> leftVector, java.util.Map<java.lang.CharSequence,​java.lang.Integer> rightVector)
      Calculates the cosine similarity for two given vectors.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CosineSimilarity

        public CosineSimilarity()
    • Method Detail

      • cosineSimilarity

        public java.lang.Double cosineSimilarity​(java.util.Map<java.lang.CharSequence,​java.lang.Integer> leftVector,
                                                 java.util.Map<java.lang.CharSequence,​java.lang.Integer> rightVector)
        Calculates the cosine similarity for two given vectors.
        Parameters:
        leftVector - left vector
        rightVector - right vector
        Returns:
        cosine similarity between the two vectors