## org.apache.mahout.common.distance
Interface DistanceMeasure

All Superinterfaces:
  Parametered

All Known Implementing Classes:
  ChebyshevDistanceMeasure, CosineDistanceMeasure, EuclideanDistanceMeasure, MahalanobisDistanceMeasure, ManhattanDistanceMeasure, MinkowskiDistanceMeasure, SquaredEuclideanDistanceMeasure, TanimotoDistanceMeasure, WeightedDistanceMeasure, WeightedEuclideanDistanceMeasure, WeightedManhattanDistanceMeasure

    public interface DistanceMeasure

extends Parametered

This interface is used for objects which can determine a distance metric between two points

Nested Class Summary

Nested classes/interfaces inherited from interface org.apache.mahout.common.parameters.Parametered
`Parametered.ParameteredGeneralizations`

Field Summary

Fields inherited from interface org.apache.mahout.common.parameters.Parametered
`log`

Method Summary
`double` `distance(double centroidLengthSquare, Vector centroid, Vector v)` Optimized version of distance metric for sparse vectors.
`double` `distance(Vector v1, Vector v2)` Returns the distance metric applied to the arguments

Methods inherited from interface org.apache.mahout.common.parameters.Parametered
`configure, createParameters, getParameters`

Method Detail

### distance

    double distance(Vector v1,
                    Vector v2)

  Returns the distance metric applied to the arguments

  Parameters:
    `v1` - a Vector defining a multidimensional point in some feature space
    `v2` - a Vector defining a multidimensional point in some feature space
  Returns:
    a scalar doubles of the distance

### distance

    double distance(double centroidLengthSquare,
                    Vector centroid,
                    Vector v)

  Optimized version of distance metric for sparse vectors. This distance computation requires operations proportional to the number of non-zero elements in the vector instead of the cardinality of the vector.

  Parameters:
    `centroidLengthSquare` - Square of the length of centroid
    `centroid` - Centroid vector

Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.