Package ai.libs.jaicore.basic.metric
Class ManhattanDistance
- java.lang.Object
-
- ai.libs.jaicore.basic.metric.ManhattanDistance
-
- All Implemented Interfaces:
org.api4.java.common.math.IMetric<double[]>,IDistanceMetric
public class ManhattanDistance extends java.lang.Object implements IDistanceMetric
Implementation of the Manhattan distance for time series. The Manhattan distance for two time seriesAandBof lengthnis defined as\sum_{i=0}^{n} |A_i - B_i|. Therefore, it is required forAandBto be of the same length.
-
-
Constructor Summary
Constructors Constructor Description ManhattanDistance()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doubledistance(double[] a, double[] b)Calculates the distance between two time series.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.api4.java.common.metric.IDistanceMetric
getDistance
-
-
-
-
Method Detail
-
distance
public double distance(double[] a, double[] b)Description copied from interface:IDistanceMetricCalculates the distance between two time series.- Specified by:
distancein interfaceIDistanceMetric- Parameters:
a- First time series.b- Second time series.- Returns:
- Distance between the first and second time series.
-
-