Class CosineDistance<DATA>

  • Type Parameters:
    DATA - The input data type. This delta function works with a double[], but can extract/convert to it from any other given object in case the respective extractor has been set. See ExtractionAwareDeltaFunction for more information.
    All Implemented Interfaces:
    Serializable, DeltaFunction<DATA>

    @PublicEvolving
    public class CosineDistance<DATA>
    extends ExtractionAwareDeltaFunction<DATA,​double[]>
    This delta function calculates the cosine distance between two given vectors. The cosine distance is defined as: cosineDistance=1-cosineSimilarity

    Cosine similarity: http://en.wikipedia.org/wiki/Cosine_similarity

    See Also:
    Serialized Form
    • Constructor Detail

      • CosineDistance

        public CosineDistance()
      • CosineDistance

        public CosineDistance​(Extractor<DATA,​double[]> converter)
    • Method Detail

      • getNestedDelta

        public double getNestedDelta​(double[] oldDataPoint,
                                     double[] newDataPoint)
        Description copied from class: ExtractionAwareDeltaFunction
        This method is exactly the same as DeltaFunction.getDelta(Object, Object) except that it gets the result of the previously done extractions as input. Therefore, this method only does the actual calculation of the delta but no data extraction or conversion.
        Specified by:
        getNestedDelta in class ExtractionAwareDeltaFunction<DATA,​double[]>
        Parameters:
        oldDataPoint - the older data point.
        newDataPoint - the new data point.
        Returns:
        the delta between the two points.