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) = 0
if 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 double
Returns the distance measure between two objects.default double
applyAsDouble
(T x, T y) double
Returns the distance measure between two objects.default Matrix
Returns the pairwise distance matrix.default Matrix
Returns 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:
applyAsDouble
in 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.
-