metrics
Class CityBlockMetric

java.lang.Object
  extended by metrics.CityBlockMetric
All Implemented Interfaces:
MetricModel

public class CityBlockMetric
extends java.lang.Object
implements MetricModel

City block metric return distance calculated by function: sum|x_i - y_i| for each element from inputs vectors, where x_i is first input vector element, y_i is second vector element.


Constructor Summary
CityBlockMetric()
          Creates a new instance of CityBlockMetric
 
Method Summary
 double getDistance(double[] firstVector, double[] secondVector)
          Return value containing the distance information.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CityBlockMetric

public CityBlockMetric()
Creates a new instance of CityBlockMetric

Method Detail

getDistance

public double getDistance(double[] firstVector,
                          double[] secondVector)
Return value containing the distance information. firstVector vector and secondVector must have the same size otherwise function return -1

Specified by:
getDistance in interface MetricModel
Parameters:
firstVector - first input vector
secondVector - second input vector
Returns:
distance information