public class DoubleTupleDistanceFunctions extends Object
DistanceFunction instances
for DoubleTuples| Modifier and Type | Method and Description |
|---|---|
static DistanceFunction<DoubleTuple> |
angular()
Returns a
DistanceFunction that computes the
angular distance (that is, 1-c,
where c is the cosine similarity) |
static Comparator<DoubleTuple> |
byDistanceComparator(DoubleTuple reference,
java.util.function.ToDoubleBiFunction<? super DoubleTuple,? super DoubleTuple> distanceFunction)
Returns a new comparator that compares
DoubleTuple instances
by their distance to the given reference, according to the given
distance function. |
static double |
computeEuclidean(DoubleTuple t0,
DoubleTuple t1)
Computes the Euclidean distance between the given tuples
|
static double |
computeEuclideanSquared(DoubleTuple t0,
DoubleTuple t1)
Computes the squared Euclidean distance between the given tuples
|
static DistanceFunction<DoubleTuple> |
dynamicTimeWarping()
Returns a
DistanceFunction that computes the dynamic
time warping distance between two DoubleTuples |
static DistanceFunction<DoubleTuple> |
euclidean()
Returns a
DistanceFunction that computes the
Euclidean distance |
static DistanceFunction<DoubleTuple> |
euclideanSquared()
Returns a
DistanceFunction that computes the
squared Euclidean distance |
public static Comparator<DoubleTuple> byDistanceComparator(DoubleTuple reference, java.util.function.ToDoubleBiFunction<? super DoubleTuple,? super DoubleTuple> distanceFunction)
DoubleTuple instances
by their distance to the given reference, according to the given
distance function.
A copy of the given reference point will be stored, so that changes
in the given point will not affect the returned comparator.reference - The reference pointdistanceFunction - The distance functionpublic static DistanceFunction<DoubleTuple> euclidean()
DistanceFunction that computes the
Euclidean distanceDistanceFunctionpublic static DistanceFunction<DoubleTuple> euclideanSquared()
DistanceFunction that computes the
squared Euclidean distanceDistanceFunctionpublic static double computeEuclidean(DoubleTuple t0, DoubleTuple t1)
t0 - The first tuplet1 - The second tupleIllegalArgumentException - If the given tuples do not
have the same sizepublic static double computeEuclideanSquared(DoubleTuple t0, DoubleTuple t1)
t0 - The first tuplet1 - The second tupleIllegalArgumentException - If the given tuples do not
have the same sizepublic static DistanceFunction<DoubleTuple> angular()
DistanceFunction that computes the
angular distance (that is, 1-c,
where c is the cosine similarity)DistanceFunctionpublic static DistanceFunction<DoubleTuple> dynamicTimeWarping()
DistanceFunction that computes the dynamic
time warping distance between two DoubleTuplesDistanceFunctionCopyright © 2015. All Rights Reserved.