public class EuclideanDistance extends Object implements Distance<Vector>, Serializable
EuclideanDistanceclass implements standard Euclidean distance between vectors. Euclidean distance forms a metric. Euclidean distance is often called the
L2distance, because it is 2-norm Minkowski distance.
The definition of Euclidean distance over vectors
withdistance(v1,v2) = sqrt(Σi (v1[i] - v2[i])2 )
v1[i]standing for the method call
iranging over the dimensions of the vectors, which must be the same.
Note that the Euclidean distance is equivalent to the
Minkowski distance metric of order 2. See the class
MinkowskiDistance for more information.
An understandable explanation of Euclidean and related distances may be found at:
|Modifier and Type||Field and Description|
The Euclidean distance.
|Constructor and Description|
Construct a new Euclidean distance.
|Modifier and Type||Method and Description|
Returns the Euclidean distance between the specified pair of vectors.
public static final EuclideanDistance DISTANCE