Class DistanceUtil

java.lang.Object
org.ddolib.util.DistanceUtil

public class DistanceUtil extends Object
  • Constructor Details

    • DistanceUtil

      public DistanceUtil()
  • Method Details

    • jaccardDistance

      public static double jaccardDistance(BitSet a, BitSet b)
      Computes the Jaccard Distance between the two given sets.
      Parameters:
      a - the first set
      b - the second set
      Returns:
      1 - |a ∩ b| / |a ∪ b|
    • weightedJaccardDistance

      public static double weightedJaccardDistance(BitSet a, BitSet b, double[] weights)
      Computes the weighted Jaccard Distance between the two given sets.
      Parameters:
      a - the first set
      b - the second set
      weights - the weight of each element in a and b
      Returns:
      the weighted Jaccard Distance between a and b
    • diceDistance

      public static double diceDistance(BitSet a, BitSet b)
      Computes the Dice Distance between the two given sets.
      Parameters:
      a - the first set
      b - the second set
      Returns:
      1 - 2|a ∩ b| / (|a| + |b|)
    • euclideanDistance

      public static double euclideanDistance(double[] a, double[] b)
      Computes the Euclidean Distance between the two given arrays of coordinates
      Parameters:
      a - the first array
      b - the second array
      Returns:
      the Euclidean distance between a and b
    • symmetricDifferenceDistance

      public static double symmetricDifferenceDistance(BitSet a, BitSet b)
      Computes the size of the symmetric difference between a and b
      Parameters:
      a - the first set
      b - the second set
      Returns:
      |a XOR b|
    • weightedSymmetricDifferenceDistance

      public static double weightedSymmetricDifferenceDistance(BitSet a, BitSet b, double[] weights)
      Computes the weighted symmetric difference between a and b
      Parameters:
      a - the first set
      b - the second set
      Returns:
      the weighted symmetric difference between a and b