Catalano.Math.Distances
Class Distance
- java.lang.Object
-
- Catalano.Math.Distances.Distance
-
public final class Distance extends java.lang.ObjectDefines 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 doubleArithmeticGeometricDivergence(double[] p, double[] q)static doubleBhattacharyya(double[] histogram1, double[] histogram2)Bhattacharyya distance between two normalized histograms.static doubleBrayCurtis(double[] p, double[] q)Gets the Bray Curtis distance between two points.static doubleBrayCurtis(double x1, double y1, double x2, double y2)Gets the Bray Curtis distance between two points.static doubleBrayCurtis(IntPoint p, IntPoint q)Gets the Bray Curtis distance between two points.static doubleCanberra(double[] p, double[] q)Gets the Canberra distance between two points.static doubleCanberra(double x1, double y1, double x2, double y2)Gets the Canberra distance between two points.static doubleCanberra(IntPoint p, IntPoint q)Gets the Canberra distance between two points.static doubleChebyshev(double[] p, double[] q)Gets the Chebyshev distance between two points.static doubleChebyshev(double x1, double y1, double x2, double y2)Gets the Chebyshev distance between two points.static doubleChebyshev(IntPoint p, IntPoint q)Gets the Chebyshev distance between two points.static doubleChessboard(double[] x, double[] y)Gets the Chessboard distance between two points.static doubleChessboard(double x1, double y1, double x2, double y2)Gets the Chessboard distance between two points.static doubleChessboard(IntPoint p, IntPoint q)Gets the Chessboard distance between two points.static doubleChiSquare(double[] histogram1, double[] histogram2)Gets the Chi Square distance between two normalized histograms.static doubleCorrelation(double[] p, double[] q)Gets the Correlation distance between two points.static doubleCosine(double[] p, double[] q)Gets the Cosine distance between two points.static doubleCosine(double x1, double y1, double x2, double y2)Gets the Cosine distance between two points.static doubleCosine(IntPoint p, IntPoint q)Gets the Cosine distance between two points.static doubleEuclidean(double[] p, double[] q)Gets the Euclidean distance between two points.static doubleEuclidean(double x1, double y1, double x2, double y2)Gets the Euclidean distance between two points.static doubleEuclidean(IntPoint p, IntPoint q)Gets the Euclidean distance between two points.static intHamming(java.lang.String first, java.lang.String second)Gets the Hamming distance between two strings.static doubleJaccardDistance(double[] p, double[] q)Gets the Jaccard distance between two points.static doubleJDivergence(double[] p, double[] q)Gets the J-Divergence.static doubleJensenDifferenceDivergence(double[] p, double[] q)Gets the Jensen difference divergence.static doubleJensenShannonDivergence(double[] p, double[] q)Gets the Jensen Shannon divergence.static doubleKDivergence(double[] p, double[] q)Gets the K-Divergence.static doubleKullbackLeiblerDivergence(double[] p, double[] q)Gets the Kullback Leibler divergence.static doubleKumarJohnsonDivergence(double[] p, double[] q)Gets the Kumar-Johnson divergence.static doubleMahalanobis(double[][] A, double[][] B)Gets the Mahalanobis distance.static doubleManhattan(double[] p, double[] q)Gets the Manhattan distance between two points.static doubleManhattan(double x1, double y1, double x2, double y2)Gets the Manhattan distance between two points.static doubleManhattan(IntPoint p, IntPoint q)Gets the Manhattan distance between two points.static doubleMinkowski(double[] u, double[] v, double p)Gets the Minkowski distance between two points.static doubleMinkowski(double x1, double y1, double x2, double y2, int r)Gets the Minkowski distance between two points.static doubleMinkowski(IntPoint p, IntPoint q, int r)Gets the Minkowski distance between two points.static doubleQuasiEuclidean(double x1, double y1, double x2, double y2)Gets the Quasi-Euclidean distance between two points.static doubleQuasiEuclidean(IntPoint p, IntPoint q)Gets the Quasi-Euclidean distance between two points.static doubleSquaredEuclidean(double[] x, double[] y)Gets the Square Euclidean distance between two points.static doubleSquaredEuclidean(double x1, double y1, double x2, double y2)Gets the Squared Euclidean distance between two points.static doubleSquaredEuclidean(IntPoint p, IntPoint q)Gets the Squared Euclidean distance between two points.static doubleSymmetricChiSquareDivergence(double[] p, double[] q)Gets the Symmetric Chi-square divergence.static doubleSymmetricKullbackLeibler(double[] p, double[] q)Gets the Symmetric Kullback-Leibler distance.static doubleTaneja(double[] p, double[] q)Gets the Taneja divergence.static doubleTopsoeDivergence(double[] p, double[] q)Gets the Topsoe divergence.
-
-
-
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