Package ai.libs.jaicore.basic.metric
Class DerivateTransformDistance
- java.lang.Object
-
- ai.libs.jaicore.basic.metric.DerivateTransformDistance
-
- All Implemented Interfaces:
org.api4.java.common.math.IMetric<double[]>,IDistanceMetric
public class DerivateTransformDistance extends java.lang.Object implements IDistanceMetric
Implementation of the Derivate Transform Distance (TD) measure as published in "Non-isometric transforms in time series classification using DTW" by Tomasz Gorecki and Maciej Luczak (2014). As the name suggests, with the Derivate Transform Distance the author combine their previously approaches of @see DerivateDistance and @see TransformDistance. Given a distance measured, the Derivate Transform Distance for the two time seriesAandBis:a * d(A, B) + b * d(A', B') + c * d(t(A), t(B)), whereA'andB'are the derivates (@see jaicore.ml.tsc.filter.derivate) andt(A)andt(B)are transforms (@see jaicore.ml.tsc.filter.transform) ofAandBrespec. and0 <= a <= 1, 0 <= b <= 1, 0 <= c <= 1>are parameters of the measure. The Derivate Transform Distance that uses Dynamic Time Warping as underlying distance measure is commonly denoted as DTD_DTW. The Derivate Transform Distance that uses the Euclidean distance as underlying distance measure is commonly denoted as TD_ED.It is also possible to use a distinct distance measure to calculate the distance between the time series, its transforms and its derivates.
-
-
Constructor Summary
Constructors Constructor Description DerivateTransformDistance(double a, double b, double c, ADerivateFilter derivate, IVectorTransform transform, IDistanceMetric distance)Constructor that uses the same distance measures for function, derivate and transform values.DerivateTransformDistance(double a, double b, double c, ADerivateFilter derivate, IVectorTransform transform, IDistanceMetric timeSeriesDistance, IDistanceMetric derivateDistance, IDistanceMetric transformDistance)Constructor with individual distance measure for function, derivate and transform values.DerivateTransformDistance(double a, double b, double c, IDistanceMetric distance)Constructor that uses the same distance measures for function, derivate and transform values.DerivateTransformDistance(double a, double b, double c, IDistanceMetric timeSeriesDistance, IDistanceMetric derivateDistance, IDistanceMetric transformDistance)Constructor with individual distance measure for function, derivate and transform values that uses theBackwardDifferencetransformas derivate and theCosineTransformas transformation.
-
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.doublegetA()Getter for theaparameter.doublegetB()Getter for thebparameter.doublegetC()Getter for thecparameter.voidsetA(double a)Sets theaparameter.voidsetB(double b)Sets thebparameter.voidsetC(double c)Sets thecparameter.-
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
-
-
-
-
Constructor Detail
-
DerivateTransformDistance
public DerivateTransformDistance(double a, double b, double c, ADerivateFilter derivate, IVectorTransform transform, IDistanceMetric timeSeriesDistance, IDistanceMetric derivateDistance, IDistanceMetric transformDistance)Constructor with individual distance measure for function, derivate and transform values.- Parameters:
a- Determines the influence of distance of the derivate values to the overall distance measure.b- Determines the influence of distance of the transform values to the overall distance measure.c- Determines the influence of distance of the transform values to the overall distance measure.derivate- The derivate calculation to use.transform- The transform calculation to use.timeSeriesDistance- The distance measure to use to calculate the distance of the function values.derivateDistance- The distance measure to use to calculate the distance of the derivate values.transformDistance- The distance measure to use to calculate the distance of the transform values.
-
DerivateTransformDistance
public DerivateTransformDistance(double a, double b, double c, IDistanceMetric timeSeriesDistance, IDistanceMetric derivateDistance, IDistanceMetric transformDistance)Constructor with individual distance measure for function, derivate and transform values that uses theBackwardDifferencetransformas derivate and theCosineTransformas transformation.- Parameters:
a- Determines the influence of distance of the derivate values to the overall distance measure.b- Determines the influence of distance of the transform values to the overall distance measure.c- Determines the influence of distance of the transform values to the overall distance measure.timeSeriesDistance- The distance measure to use to calculate the distance of the function values.derivateDistance- The distance measure to use to calculate the distance of the derivate values.transformDistance- The distance measure to use to calculate the distance of the transform values.
-
DerivateTransformDistance
public DerivateTransformDistance(double a, double b, double c, ADerivateFilter derivate, IVectorTransform transform, IDistanceMetric distance)Constructor that uses the same distance measures for function, derivate and transform values.- Parameters:
a- Determines the influence of distance of the derivate values to the overall distance measure.b- Determines the influence of distance of the transform values to the overall distance measure.c- Determines the influence of distance of the transform values to the overall distance measure.derivate- The derivate calculation to use.transform- The transform calculation to use.distance- The distance measure to use of the function, derivate and transform values.
-
DerivateTransformDistance
public DerivateTransformDistance(double a, double b, double c, IDistanceMetric distance)Constructor that uses the same distance measures for function, derivate and transform values.- Parameters:
a- Determines the influence of distance of the derivate values to the overall distance measure.b- Determines the influence of distance of the transform values to the overall distance measure.c- Determines the influence of distance of the transform values to the overall distance measure.distance- The distance measure to use of the function, derivate and transform values.
-
-
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.
-
setA
public void setA(double a)
Sets theaparameter. @see #a- Parameters:
a- Theaparameter,0 <= a <= 1.
-
setB
public void setB(double b)
Sets thebparameter. @see #b- Parameters:
a- Thebparameter,0 <= b <= 1.
-
setC
public void setC(double c)
Sets thecparameter. @see #c- Parameters:
a- Thecparameter,0 <= c <= 1.
-
getA
public double getA()
Getter for theaparameter. @see #a
-
getB
public double getB()
Getter for thebparameter. @see #b
-
getC
public double getC()
Getter for thecparameter. @see #c
-
-