Class DynamicTimeWarping

java.lang.Object
org.palladiosimulator.edp2.distancemetrics.DynamicTimeWarping
All Implemented Interfaces:
DistanceMetric

public class DynamicTimeWarping extends Object implements DistanceMetric
This algorithm calculates the distance with the Dynamic Time Warping principle. This implementation is based on the pseudo code of the windowed variant of the following wikipedia article: https://en.wikipedia.org/wiki/Dynamic_time_warping Note: This class doesn't use the TupleWrapper class from the Utility package because it doesn't need the time values and it would so cause an overhead. Besides that an array with infinity values needs to be initialized which would make it neccessary to create TupleMeasurements initialized to infinity but with unknown time values.
  • Constructor Details

    • DynamicTimeWarping

      public DynamicTimeWarping()
  • Method Details

    • calculateDistance

      public org.jscience.physics.amount.Amount<?> calculateDistance(IDataStream<org.palladiosimulator.measurementframework.TupleMeasurement> s1, IDataStream<org.palladiosimulator.measurementframework.TupleMeasurement> s2)
      Description copied from interface: DistanceMetric
      This method contains the distance metric algorithm.
      Specified by:
      calculateDistance in interface DistanceMetric
      Parameters:
      s1 - First stream of measurement to compare.
      s2 - Second stream of measurement to compare.
      Returns:
      Return a generic Amount which can contain any Quantity. Returns null, if calcuation couldn't be executed.
    • setWindow

      public void setWindow(int window)
      Sets the window size which is the search space the DTW algorithm should look for shortest distance.
      Parameters:
      window - The size of the window.