E - the type of objects over which distances are definedpublic interface Distance<E>
Distance interface provides a general method for
defining distances between two objects. Distance is a kind of
dissimilarity measure, because the larger the distance between two
objects, the less similar they are. The distance interface
provides a single method distance(Object,Object) returning
the distance between objects.
A proper distance is said to form a metric if it satisfies the following four properties:
distance(x,y) >= 0
distance(x,x) = 0
distance(x,y) = distance(y,x)
distance(x,y) + distance(y,z) >= distance(x,z)
For example, the Euclidean distance between vectors is a proper metric.
as is the Manhattan metric, or taxicab distance:distance(x,y) = sqrt(Σi (x[i] * y[i])2)
Cosine is also popular for vectors:distance(x,y) = Σi abs(x[i] - y[i])
distance(x,y) = dotProduct(x,y) / (length(x) * length(y))
A good introduction to distance may be found at:
Copyright © 2016 Alias-i, Inc.. All rights reserved.