Package smile.math.distance
Interface Distance<T>
- Type Parameters:
T- the input type of distance function.
- All Superinterfaces:
Serializable,ToDoubleBiFunction<T,T>
- All Known Subinterfaces:
Metric<T>
- All Known Implementing Classes:
ChebyshevDistance,CorrelationDistance,DynamicTimeWarping,EditDistance,EuclideanDistance,HammingDistance,JaccardDistance,JensenShannonDistance,LeeDistance,MahalanobisDistance,ManhattanDistance,MinkowskiDistance,SparseChebyshevDistance,SparseEuclideanDistance,SparseManhattanDistance,SparseMinkowskiDistance,TaxonomicDistance
An interface to calculate a distance measure between two objects. A distance
function maps pairs of points into the non-negative reals and has to satisfy
- non-negativity:
d(x, y) >= 0 - isolation:
d(x, y) = 0if and only ifx = y - symmetry:
d(x, y) = d(x, y)
|x - y| + |y - z| >= |x - z|, which is necessary for a metric.-
Method Summary
Modifier and TypeMethodDescriptiondefault doubleReturns the distance measure between two objects.default doubleapplyAsDouble(T x, T y) doubleReturns the distance measure between two objects.default MatrixReturns the pairwise distance matrix.default MatrixReturns the pairwise distance matrix.
-
Method Details
-
d
Returns the distance measure between two objects.- Parameters:
x- an object.y- an object.- Returns:
- the distance.
-
apply
Returns the distance measure between two objects. This is simply for Scala convenience.- Parameters:
x- an object.y- an object.- Returns:
- the distance.
-
applyAsDouble
- Specified by:
applyAsDoublein interfaceToDoubleBiFunction<T,T>
-
D
Returns the pairwise distance matrix.- Parameters:
x- samples.- Returns:
- the pairwise distance matrix.
-
D
Returns the pairwise distance matrix.- Parameters:
x- samples.y- samples.- Returns:
- the pairwise distance matrix.
-