Documentation of 'Catalano.Math.Distances.Distance' Java class
Distance
Catalano.Math.Distances

Class Distance



  • public final class Distance
    extends java.lang.Object
    Defines a set of extension methods defining distance measures. References: http://www.ajmaa.org/RGMIA/papers/v7n4/Gsdmi_RGMIA.pdf http://arabic-icr.googlecode.com/git/Papers/Comprehensive%20Survey%20on%20Distance-Similarity.pdf
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static double ArithmeticGeometricDivergence(double[] p, double[] q) 
      static double Bhattacharyya(double[] histogram1, double[] histogram2)
      Bhattacharyya distance between two normalized histograms.
      static double BrayCurtis(double[] p, double[] q)
      Gets the Bray Curtis distance between two points.
      static double BrayCurtis(double x1, double y1, double x2, double y2)
      Gets the Bray Curtis distance between two points.
      static double BrayCurtis(IntPoint p, IntPoint q)
      Gets the Bray Curtis distance between two points.
      static double Canberra(double[] p, double[] q)
      Gets the Canberra distance between two points.
      static double Canberra(double x1, double y1, double x2, double y2)
      Gets the Canberra distance between two points.
      static double Canberra(IntPoint p, IntPoint q)
      Gets the Canberra distance between two points.
      static double Chebyshev(double[] p, double[] q)
      Gets the Chebyshev distance between two points.
      static double Chebyshev(double x1, double y1, double x2, double y2)
      Gets the Chebyshev distance between two points.
      static double Chebyshev(IntPoint p, IntPoint q)
      Gets the Chebyshev distance between two points.
      static double Chessboard(double[] x, double[] y)
      Gets the Chessboard distance between two points.
      static double Chessboard(double x1, double y1, double x2, double y2)
      Gets the Chessboard distance between two points.
      static double Chessboard(IntPoint p, IntPoint q)
      Gets the Chessboard distance between two points.
      static double ChiSquare(double[] histogram1, double[] histogram2)
      Gets the Chi Square distance between two normalized histograms.
      static double Correlation(double[] p, double[] q)
      Gets the Correlation distance between two points.
      static double Cosine(double[] p, double[] q)
      Gets the Cosine distance between two points.
      static double Cosine(double x1, double y1, double x2, double y2)
      Gets the Cosine distance between two points.
      static double Cosine(IntPoint p, IntPoint q)
      Gets the Cosine distance between two points.
      static double Euclidean(double[] p, double[] q)
      Gets the Euclidean distance between two points.
      static double Euclidean(double x1, double y1, double x2, double y2)
      Gets the Euclidean distance between two points.
      static double Euclidean(IntPoint p, IntPoint q)
      Gets the Euclidean distance between two points.
      static int Hamming(java.lang.String first, java.lang.String second)
      Gets the Hamming distance between two strings.
      static double JaccardDistance(double[] p, double[] q)
      Gets the Jaccard distance between two points.
      static double JDivergence(double[] p, double[] q)
      Gets the J-Divergence.
      static double JensenDifferenceDivergence(double[] p, double[] q)
      Gets the Jensen difference divergence.
      static double JensenShannonDivergence(double[] p, double[] q)
      Gets the Jensen Shannon divergence.
      static double KDivergence(double[] p, double[] q)
      Gets the K-Divergence.
      static double KullbackLeiblerDivergence(double[] p, double[] q)
      Gets the Kullback Leibler divergence.
      static double KumarJohnsonDivergence(double[] p, double[] q)
      Gets the Kumar-Johnson divergence.
      static double Mahalanobis(double[][] A, double[][] B)
      Gets the Mahalanobis distance.
      static double Manhattan(double[] p, double[] q)
      Gets the Manhattan distance between two points.
      static double Manhattan(double x1, double y1, double x2, double y2)
      Gets the Manhattan distance between two points.
      static double Manhattan(IntPoint p, IntPoint q)
      Gets the Manhattan distance between two points.
      static double Minkowski(double[] u, double[] v, double p)
      Gets the Minkowski distance between two points.
      static double Minkowski(double x1, double y1, double x2, double y2, int r)
      Gets the Minkowski distance between two points.
      static double Minkowski(IntPoint p, IntPoint q, int r)
      Gets the Minkowski distance between two points.
      static double QuasiEuclidean(double x1, double y1, double x2, double y2)
      Gets the Quasi-Euclidean distance between two points.
      static double QuasiEuclidean(IntPoint p, IntPoint q)
      Gets the Quasi-Euclidean distance between two points.
      static double SquaredEuclidean(double[] x, double[] y)
      Gets the Square Euclidean distance between two points.
      static double SquaredEuclidean(double x1, double y1, double x2, double y2)
      Gets the Squared Euclidean distance between two points.
      static double SquaredEuclidean(IntPoint p, IntPoint q)
      Gets the Squared Euclidean distance between two points.
      static double SymmetricChiSquareDivergence(double[] p, double[] q)
      Gets the Symmetric Chi-square divergence.
      static double SymmetricKullbackLeibler(double[] p, double[] q)
      Gets the Symmetric Kullback-Leibler distance.
      static double Taneja(double[] p, double[] q)
      Gets the Taneja divergence.
      static double TopsoeDivergence(double[] p, double[] q)
      Gets the Topsoe divergence.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • ArithmeticGeometricDivergence

        public static double ArithmeticGeometricDivergence(double[] p,
                                                           double[] q)
      • Bhattacharyya

        public static double Bhattacharyya(double[] histogram1,
                                           double[] histogram2)
        Bhattacharyya distance between two normalized histograms.
        Parameters:
        histogram1 - Normalized histogram.
        histogram2 - Normalized histogram.
        Returns:
        The Bhattacharyya distance between the two histograms.
      • BrayCurtis

        public static double BrayCurtis(double[] p,
                                        double[] q)
        Gets the Bray Curtis distance between two points.
        Parameters:
        p - A point in space.
        q - A point in space.
        Returns:
        The Bray Curtis distance between x and y.
      • BrayCurtis

        public static double BrayCurtis(double x1,
                                        double y1,
                                        double x2,
                                        double y2)
        Gets the Bray Curtis distance between two points.
        Parameters:
        x1 - X1 axis coordinate.
        y1 - Y1 axis coordinate.
        x2 - X2 axis coordinate.
        y2 - X2 axis coordinate.
        Returns:
        The Bray Curtis distance between x and y.
      • BrayCurtis

        public static double BrayCurtis(IntPoint p,
                                        IntPoint q)
        Gets the Bray Curtis distance between two points.
        Parameters:
        p - IntPoint with X and Y axis coordinates.
        q - IntPoint with X and Y axis coordinates.
        Returns:
        The Bray Curtis distance between x and y.
      • Canberra

        public static double Canberra(double[] p,
                                      double[] q)
        Gets the Canberra distance between two points.
        Parameters:
        p - A point in space.
        q - A point in space.
        Returns:
        The Canberra distance between x and y.
      • Canberra

        public static double Canberra(double x1,
                                      double y1,
                                      double x2,
                                      double y2)
        Gets the Canberra distance between two points.
        Parameters:
        x1 - X1 axis coordinate.
        y1 - Y1 axis coordinate.
        x2 - X2 axis coordinate.
        y2 - Y2 axis coordinate.
        Returns:
        The Canberra distance between x and y.
      • Canberra

        public static double Canberra(IntPoint p,
                                      IntPoint q)
        Gets the Canberra distance between two points.
        Parameters:
        p - IntPoint with X and Y axis coordinates.
        q - IntPoint with X and Y axis coordinates.
        Returns:
        The Canberra distance between x and y.
      • Chebyshev

        public static double Chebyshev(double[] p,
                                       double[] q)
        Gets the Chebyshev distance between two points.
        Parameters:
        p - A point in space.
        q - A point in space.
        Returns:
        The Chebyshev distance between x and y.
      • Chebyshev

        public static double Chebyshev(double x1,
                                       double y1,
                                       double x2,
                                       double y2)
        Gets the Chebyshev distance between two points.
        Parameters:
        x1 - X1 axis coordinate.
        y1 - Y1 axis coordinate.
        x2 - X2 axis coordinate.
        y2 - Y2 axis coordinate.
        Returns:
        The Chebyshev distance between x and y.
      • Chebyshev

        public static double Chebyshev(IntPoint p,
                                       IntPoint q)
        Gets the Chebyshev distance between two points.
        Parameters:
        p - IntPoint with X and Y axis coordinates.
        q - IntPoint with X and Y axis coordinates.
        Returns:
        The Chebyshev distance between x and y.
      • Chessboard

        public static double Chessboard(double[] x,
                                        double[] y)
        Gets the Chessboard distance between two points.
        Parameters:
        x - A point in space.
        y - A point in space.
        Returns:
        The Chessboard distance between x and y.
      • Chessboard

        public static double Chessboard(double x1,
                                        double y1,
                                        double x2,
                                        double y2)
        Gets the Chessboard distance between two points.
        Parameters:
        x1 - X1 axis coordinate.
        y1 - Y1 axis coordinate.
        x2 - X2 axis coordinate.
        y2 - Y2 axis coordinate.
        Returns:
        The Chessboard distance between x and y.
      • Chessboard

        public static double Chessboard(IntPoint p,
                                        IntPoint q)
        Gets the Chessboard distance between two points.
        Parameters:
        p - IntPoint with X and Y axis coordinates.
        q - IntPoint with X and Y axis coordinates.
        Returns:
        The Chessboard distance between x and y.
      • ChiSquare

        public static double ChiSquare(double[] histogram1,
                                       double[] histogram2)
        Gets the Chi Square distance between two normalized histograms.
        Parameters:
        histogram1 - Histogram.
        histogram2 - Histogram.
        Returns:
        The Chi Square distance between x and y.
      • Correlation

        public static double Correlation(double[] p,
                                         double[] q)
        Gets the Correlation distance between two points.
        Parameters:
        p - A point in space.
        q - A point in space.
        Returns:
        The Correlation distance between x and y.
      • Cosine

        public static double Cosine(double[] p,
                                    double[] q)
        Gets the Cosine distance between two points.
        Parameters:
        p - A point in space.
        q - A point in space.
        Returns:
        The Cosine distance between x and y.
      • Cosine

        public static double Cosine(double x1,
                                    double y1,
                                    double x2,
                                    double y2)
        Gets the Cosine distance between two points.
        Parameters:
        x1 - X1 axis coordinate.
        y1 - Y1 axis coordinate.
        x2 - X2 axis coordinate.
        y2 - Y2 axis coordinate.
        Returns:
        The Cosine distance between x and y.
      • Cosine

        public static double Cosine(IntPoint p,
                                    IntPoint q)
        Gets the Cosine distance between two points.
        Parameters:
        p - IntPoint with X and Y axis coordinates.
        q - IntPoint with X and Y axis coordinates.
        Returns:
        The Cosine distance between x and y.
      • Euclidean

        public static double Euclidean(double[] p,
                                       double[] q)
        Gets the Euclidean distance between two points.
        Parameters:
        p - A point in space.
        q - A point in space.
        Returns:
        The Euclidean distance between x and y.
      • Euclidean

        public static double Euclidean(double x1,
                                       double y1,
                                       double x2,
                                       double y2)
        Gets the Euclidean distance between two points.
        Parameters:
        x1 - X1 axis coordinate.
        y1 - Y1 axis coordinate.
        x2 - X2 axis coordinate.
        y2 - Y2 axis coordinate.
        Returns:
        The Euclidean distance between x and y.
      • Euclidean

        public static double Euclidean(IntPoint p,
                                       IntPoint q)
        Gets the Euclidean distance between two points.
        Parameters:
        p - IntPoint with X and Y axis coordinates.
        q - IntPoint with X and Y axis coordinates.
        Returns:
        The Euclidean distance between x and y.
      • Hamming

        public static int Hamming(java.lang.String first,
                                  java.lang.String second)
        Gets the Hamming distance between two strings.
        Parameters:
        first - First string.
        second - Second string.
        Returns:
        The Hamming distance between p and q.
      • JaccardDistance

        public static double JaccardDistance(double[] p,
                                             double[] q)
        Gets the Jaccard distance between two points.
        Parameters:
        p - A point in space.
        q - A point in space.
        Returns:
        The Jaccard distance between x and y.
      • JDivergence

        public static double JDivergence(double[] p,
                                         double[] q)
        Gets the J-Divergence.
        Parameters:
        p - P vector.
        q - Q vector.
        Returns:
        The J-Divergence between p and q.
      • JensenDifferenceDivergence

        public static double JensenDifferenceDivergence(double[] p,
                                                        double[] q)
        Gets the Jensen difference divergence.
        Parameters:
        p - P vector.
        q - Q vector.
        Returns:
        The Jensen difference between p and q.
      • JensenShannonDivergence

        public static double JensenShannonDivergence(double[] p,
                                                     double[] q)
        Gets the Jensen Shannon divergence.
        Parameters:
        p - U vector.
        q - V vector.
        Returns:
        The Jensen Shannon divergence between u and v.
      • KDivergence

        public static double KDivergence(double[] p,
                                         double[] q)
        Gets the K-Divergence.
        Parameters:
        p - U vector.
        q - V vector.
        Returns:
        The K-Divergence between u and v.
      • KumarJohnsonDivergence

        public static double KumarJohnsonDivergence(double[] p,
                                                    double[] q)
        Gets the Kumar-Johnson divergence.
        Parameters:
        p - P vector.
        q - Q vector.
        Returns:
        The Kumar-Johnson divergence between p and q.
      • KullbackLeiblerDivergence

        public static double KullbackLeiblerDivergence(double[] p,
                                                       double[] q)
        Gets the Kullback Leibler divergence.
        Parameters:
        p - P vector.
        q - Q vector.
        Returns:
        The Kullback Leibler divergence between u and v.
      • Mahalanobis

        public static double Mahalanobis(double[][] A,
                                         double[][] B)
        Gets the Mahalanobis distance.
        Parameters:
        A - Matrix A.
        B - Matrix B.
        Returns:
        The Mahalanobis distance between A and B.
      • Manhattan

        public static double Manhattan(double[] p,
                                       double[] q)
        Gets the Manhattan distance between two points.
        Parameters:
        p - A point in space.
        q - A point in space.
        Returns:
        The Manhattan distance between x and y.
      • Manhattan

        public static double Manhattan(double x1,
                                       double y1,
                                       double x2,
                                       double y2)
        Gets the Manhattan distance between two points.
        Parameters:
        x1 - X1 axis coordinate.
        y1 - Y1 axis coordinate.
        x2 - X2 axis coordinate.
        y2 - Y2 axis coordinate.
        Returns:
        The Manhattan distance between x and y.
      • Manhattan

        public static double Manhattan(IntPoint p,
                                       IntPoint q)
        Gets the Manhattan distance between two points.
        Parameters:
        p - IntPoint with X and Y axis coordinates.
        q - IntPoint with X and Y axis coordinates.
        Returns:
        The Manhattan distance between x and y.
      • Minkowski

        public static double Minkowski(double x1,
                                       double y1,
                                       double x2,
                                       double y2,
                                       int r)
        Gets the Minkowski distance between two points.
        Parameters:
        x1 - X1 axis coordinate.
        y1 - Y1 axis coordinate.
        x2 - X2 axis coordinate.
        y2 - Y2 axis coordinate.
        r - Order between two points.
        Returns:
        The Minkowski distance between x and y.
      • Minkowski

        public static double Minkowski(IntPoint p,
                                       IntPoint q,
                                       int r)
        Gets the Minkowski distance between two points.
        Parameters:
        p - IntPoint with X and Y axis coordinates.
        q - IntPoint with X and Y axis coordinates.
        r - Order between two points.
        Returns:
        The Minkowski distance between x and y.
      • Minkowski

        public static double Minkowski(double[] u,
                                       double[] v,
                                       double p)
        Gets the Minkowski distance between two points.
        Parameters:
        u - A point in space.
        v - A point in space.
        p - Order between two points.
        Returns:
        The Minkowski distance between x and y.
      • QuasiEuclidean

        public static double QuasiEuclidean(double x1,
                                            double y1,
                                            double x2,
                                            double y2)
        Gets the Quasi-Euclidean distance between two points.
        Parameters:
        x1 - X1 axis coordinates.
        y1 - Y1 axis coordinates.
        x2 - X2 axis coordinates.
        y2 - Y2 axis coordinates.
        Returns:
        The Quasi-Euclidean distance between x and y.
      • QuasiEuclidean

        public static double QuasiEuclidean(IntPoint p,
                                            IntPoint q)
        Gets the Quasi-Euclidean distance between two points.
        Parameters:
        p - IntPoint with X and Y axis coordinates.
        q - IntPoint with X and Y axis coordinates.
        Returns:
        The Quasi Euclidean distance between p and q.
      • SquaredEuclidean

        public static double SquaredEuclidean(double[] x,
                                              double[] y)
        Gets the Square Euclidean distance between two points.
        Parameters:
        x - A point in space.
        y - A point in space.
        Returns:
        The Square Euclidean distance between x and y.
      • SquaredEuclidean

        public static double SquaredEuclidean(double x1,
                                              double y1,
                                              double x2,
                                              double y2)
        Gets the Squared Euclidean distance between two points.
        Parameters:
        x1 - X1 axis coordinates.
        y1 - Y1 axis coordinates.
        x2 - X2 axis coordinates.
        y2 - Y2 axis coordinates.
        Returns:
        The Squared euclidean distance between x and y.
      • SquaredEuclidean

        public static double SquaredEuclidean(IntPoint p,
                                              IntPoint q)
        Gets the Squared Euclidean distance between two points.
        Parameters:
        p - IntPoint with X and Y axis coordinates.
        q - IntPoint with X and Y axis coordinates.
        Returns:
        The Squared euclidean distance between x and y.
      • SymmetricChiSquareDivergence

        public static double SymmetricChiSquareDivergence(double[] p,
                                                          double[] q)
        Gets the Symmetric Chi-square divergence.
        Parameters:
        p - P vector.
        q - Q vector.
        Returns:
        The Symmetric chi-square divergence between p and q.
      • SymmetricKullbackLeibler

        public static double SymmetricKullbackLeibler(double[] p,
                                                      double[] q)
        Gets the Symmetric Kullback-Leibler distance. This metric is valid only for real and positive P and Q.
        Parameters:
        p - P vector.
        q - Q vector.
        Returns:
        The Symmetric Kullback Leibler distance between p and q.
      • Taneja

        public static double Taneja(double[] p,
                                    double[] q)
        Gets the Taneja divergence.
        Parameters:
        p - P vector.
        q - Q vector.
        Returns:
        The Taneja divergence between p and q.
      • TopsoeDivergence

        public static double TopsoeDivergence(double[] p,
                                              double[] q)
        Gets the Topsoe divergence.
        Parameters:
        p - P vector.
        q - Q vector.
        Returns:
        The Topsoe divergence between p and q.

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.