## org.apache.mahout.common.distance
Class WeightedEuclideanDistanceMeasure

    java.lang.Object
      org.apache.mahout.common.distance.WeightedDistanceMeasure
          org.apache.mahout.common.distance.WeightedEuclideanDistanceMeasure

All Implemented Interfaces:
  DistanceMeasure, Parametered

    public class WeightedEuclideanDistanceMeasure

extends WeightedDistanceMeasure

This class implements a Euclidean distance metric by summing the square root of the squared differences between each coordinate, optionally adding weights.

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`

Constructor Summary
`WeightedEuclideanDistanceMeasure()`

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

Methods inherited from class org.apache.mahout.common.distance.WeightedDistanceMeasure
`configure, createParameters, getParameters, getWeights, setWeights`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### WeightedEuclideanDistanceMeasure

    public WeightedEuclideanDistanceMeasure()

Method Detail

### distance

    public double distance(Vector p1,
                           Vector p2)

  Description copied from interface: `DistanceMeasure`
  Returns the distance metric applied to the arguments

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

### distance

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

  Description copied from interface: `DistanceMeasure`
  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.