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 seriesA
andB
is: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) ofA
andB
respec. 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 theBackwardDifferencetransform
as derivate and theCosineTransform
as transformation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
distance(double[] a, double[] b)
Calculates the distance between two time series.double
getA()
Getter for thea
parameter.double
getB()
Getter for theb
parameter.double
getC()
Getter for thec
parameter.void
setA(double a)
Sets thea
parameter.void
setB(double b)
Sets theb
parameter.void
setC(double c)
Sets thec
parameter.-
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 theBackwardDifferencetransform
as derivate and theCosineTransform
as 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:IDistanceMetric
Calculates the distance between two time series.- Specified by:
distance
in 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 thea
parameter. @see #a- Parameters:
a
- Thea
parameter,0 <= a <= 1
.
-
setB
public void setB(double b)
Sets theb
parameter. @see #b- Parameters:
a
- Theb
parameter,0 <= b <= 1
.
-
setC
public void setC(double c)
Sets thec
parameter. @see #c- Parameters:
a
- Thec
parameter,0 <= c <= 1
.
-
getA
public double getA()
Getter for thea
parameter. @see #a
-
getB
public double getB()
Getter for theb
parameter. @see #b
-
getC
public double getC()
Getter for thec
parameter. @see #c
-
-