

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
E
 the type of objects over which distances are definedpublic interface Distance<E>
The 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:
Method Summary  

double 
distance(E e1,
E e2)
Returns the distance between the specified pair of objects. 
Method Detail 

double distance(E e1, E e2)
e1
 First object.e2
 Second object.


PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 