Package weka.core

Class AbstractStringDistanceFunction

    • Constructor Detail

      • AbstractStringDistanceFunction

        public AbstractStringDistanceFunction()
        Constructor that doesn't set the data
      • AbstractStringDistanceFunction

        public AbstractStringDistanceFunction​(Instances data)
        Constructor that sets the data
        Parameters:
        data - the set of instances that will be used for later distance comparisons
    • Method Detail

      • distance

        public double distance​(Instance first,
                               Instance second,
                               double cutOffValue,
                               PerformanceStats stats)
        Calculates the distance between two instances. Offers speed up (if the distance function class in use supports it) in nearest neighbour search by taking into account the cutOff or maximum distance. Depending on the distance function class, post processing of the distances by postProcessDistances(double []) may be required if this function is used.
        Specified by:
        distance in interface DistanceFunction
        Overrides:
        distance in class NormalizableDistance
        Parameters:
        first - the first instance
        second - the second instance
        cutOffValue - If the distance being calculated becomes larger than cutOffValue then the rest of the calculation is discarded.
        stats - the performance stats object
        Returns:
        the distance between the two given instances or Double.POSITIVE_INFINITY if the distance being calculated becomes larger than cutOffValue.