Class 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 measure d, the Derivate Transform Distance for the two time series A and B is: a * d(A, B) + b * d(A', B') + c * d(t(A), t(B)), where A' and B' are the derivates (@see jaicore.ml.tsc.filter.derivate) and t(A) and t(B) are transforms (@see jaicore.ml.tsc.filter.transform) of A and B respec. and 0 <= 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 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 the BackwardDifferencetransform as derivate and the CosineTransform 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 interface IDistanceMetric
        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 the a parameter. @see #a
        Parameters:
        a - The a parameter, 0 <= a <= 1.
      • setB

        public void setB​(double b)
        Sets the b parameter. @see #b
        Parameters:
        a - The b parameter, 0 <= b <= 1.
      • setC

        public void setC​(double c)
        Sets the c parameter. @see #c
        Parameters:
        a - The c parameter, 0 <= c <= 1.
      • getA

        public double getA()
        Getter for the a parameter. @see #a
      • getB

        public double getB()
        Getter for the b parameter. @see #b
      • getC

        public double getC()
        Getter for the c parameter. @see #c