Class ShotgunDistance

  • All Implemented Interfaces:
    org.api4.java.common.math.IMetric<double[]>, IDistanceMetric

    public class ShotgunDistance
    extends java.lang.Object
    implements IDistanceMetric
    Implementation of Shotgun Distance measure as published in "Towards Time Series Classfication without Human Preprocessing" by Patrick Schäfer (2014). To make many of the standard methods to calculate the distance betwenn two time series applicable, a lot of time and effort has to be spent by a domain expert to filter the data and extrdact equal-length, equal-scale and alighned patterns. The Shotgun Distance avoids preprocessing the data for alignment, scaling or length. This is achieved by breaking the query time series into disjoint windows (subsequences) of fixed length. These windows are slid along the sample time series (with stride 1) to find the best matching position in terms of minimizing a distance metric (e.g. Euclidean distance or DTW distance).
    • Constructor Summary

      Constructors 
      Constructor Description
      ShotgunDistance​(int windowLength, boolean meanNormalization)
      Constructor for the Shotgun Distance.
    • 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.
      void setWindowLength​(int windowLength)
      Sets the window length.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ShotgunDistance

        public ShotgunDistance​(int windowLength,
                               boolean meanNormalization)
        Constructor for the Shotgun Distance.
        Parameters:
        windowLength - The window length.
        meanNormalization - Mean normalization. If false, no mean substraction at vertical alignment of windows.
    • 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.
      • setWindowLength

        public void setWindowLength​(int windowLength)
        Sets the window length.
        Parameters:
        windowLength -
        See Also:
        windowLength