org.apache.mahout.math.hadoop.similarity.vector
Class DistributedCityBlockVectorSimilarity

java.lang.Object
  extended by org.apache.mahout.math.hadoop.similarity.vector.AbstractDistributedVectorSimilarity
      extended by org.apache.mahout.math.hadoop.similarity.vector.DistributedCityBlockVectorSimilarity
All Implemented Interfaces:
DistributedVectorSimilarity

public final class DistributedCityBlockVectorSimilarity
extends AbstractDistributedVectorSimilarity

Implementation of City Block distance (also known as Manhattan distance) - the absolute value of the difference of each direction is summed. The resulting unbounded distance is then mapped between 1 and -1.


Constructor Summary
DistributedCityBlockVectorSimilarity()
           
 
Method Summary
protected  double doComputeResult(int rowA, int rowB, Iterable<Cooccurrence> cooccurrences, double weightOfVectorA, double weightOfVectorB, int numberOfColumns)
          do the actual similarity computation
 double weight(Vector v)
          vectors have no weight (NaN) by default, subclasses may override this
 
Methods inherited from class org.apache.mahout.math.hadoop.similarity.vector.AbstractDistributedVectorSimilarity
countElements, countElements, similarity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DistributedCityBlockVectorSimilarity

public DistributedCityBlockVectorSimilarity()
Method Detail

doComputeResult

protected double doComputeResult(int rowA,
                                 int rowB,
                                 Iterable<Cooccurrence> cooccurrences,
                                 double weightOfVectorA,
                                 double weightOfVectorB,
                                 int numberOfColumns)
Description copied from class: AbstractDistributedVectorSimilarity
do the actual similarity computation

Specified by:
doComputeResult in class AbstractDistributedVectorSimilarity
See Also:
DistributedVectorSimilarity.similarity(int, int, Iterable, double, double, int)

weight

public double weight(Vector v)
Description copied from class: AbstractDistributedVectorSimilarity
vectors have no weight (NaN) by default, subclasses may override this

Specified by:
weight in interface DistributedVectorSimilarity
Overrides:
weight in class AbstractDistributedVectorSimilarity


Copyright © 2008-2011 The Apache Software Foundation. All Rights Reserved.