Class InvertedDistanceSimilarity<O>

  • Type Parameters:
    O - Object type
    All Implemented Interfaces:
    PrimitiveSimilarity<O>, Similarity<O>

    public class InvertedDistanceSimilarity<O>
    extends java.lang.Object
    implements PrimitiveSimilarity<O>
    Adapter to use a primitive number-distance as similarity measure, by computing 1/distance.
    Since:
    0.5.0
    Author:
    Erich Schubert
    • Field Detail

      • DISTANCE_FUNCTION_ID

        public static final OptionID DISTANCE_FUNCTION_ID
        Parameter to specify the similarity function to derive the distance between database objects from. Must extend Distance .
      • distanceFunction

        protected PrimitiveDistance<? super O> distanceFunction
        Holds the similarity function.
    • Constructor Detail

      • InvertedDistanceSimilarity

        public InvertedDistanceSimilarity()
    • Method Detail

      • similarity

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