Class HammingDistance

    • Constructor Detail

      • HammingDistance

        public HammingDistance()
    • Method Detail

      • isMetric

        public boolean isMetric()
        Description copied from interface: Distance
        Is this distance function metric (satisfy the triangle inequality)
        Specified by:
        isMetric in interface Distance<FeatureVector<?>>
        Returns:
        true when metric.
      • distance

        public double distance​(FeatureVector<?> o1,
                               FeatureVector<?> o2)
        Description copied from interface: PrimitiveDistance
        Computes the distance between two given DatabaseObjects according to this distance function.
        Specified by:
        distance in interface PrimitiveDistance<FeatureVector<?>>
        Parameters:
        o1 - first DatabaseObject
        o2 - second DatabaseObject
        Returns:
        the distance between two given DatabaseObjects according to this distance function
      • distance

        public double distance​(NumberVector o1,
                               NumberVector o2)
        Description copied from interface: NumberVectorDistance
        Computes the distance between two given vectors according to this distance function.
        Specified by:
        distance in interface NumberVectorDistance<FeatureVector<?>>
        Parameters:
        o1 - first vector
        o2 - second vector
        Returns:
        the distance between two given vectors according to this distance function
      • hammingDistanceNumberVector

        private double hammingDistanceNumberVector​(NumberVector o1,
                                                   NumberVector o2)
        Version for number vectors.
        Parameters:
        o1 - First vector
        o2 - Second vector
        Returns:
        hamming distance
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object