DTW¶
- class dtw.DTW(obj)¶
- Bases: - object- The results of an alignment operation. - Objects of class DTW contain alignments computed by the [dtw()] function. - Attributes: - distancethe minimum global distance computed, not normalized.
- normalizedDistancedistance computed, normalized for path length, if normalization is known for chosen step pattern.
- N,Mquery and reference length
- callthe function call that created the object
- index1matched elements: indices in- x
- index2corresponding mapped indices in- y
- stepPatternthe- stepPatternobject used for the computation
- jminlast element of reference matched, if- open_end=True
- directionMatrixif- keep_internals=True, the directions of steps that would be taken at each alignment pair (integers indexing production rules in the chosen step pattern)
- stepsTakenthe list of steps taken from the beginning to the end of the alignment (integers indexing chosen step pattern)
- index1s, index2ssame as- index1/2, excluding intermediate steps for multi-step patterns like [asymmetricP05()]
- costMatrixif- keep_internals=True, the cumulative cost matrix
- query, referenceif- keep_internals=Trueand passed as the- xand- yarguments, the query and reference timeseries.
 - Methods Summary - plot([type])- Plotting of dynamic time warp results - Methods Documentation - plot(type='alignment', **kwargs)¶
- Plotting of dynamic time warp results - Methods for plotting dynamic time warp alignment objects returned by [dtw()]. - Details - dtwPlotdisplays alignment contained in- dtwobjects.- Various plotting styles are available, passing strings to the - typeargument (may be abbreviated):- alignmentplots the warping curve in- d;
- twowayplots a point-by-point comparison, with matching lines; see [dtwPlotTwoWay()];
- threewayvis-a-vis inspection of the timeseries and their warping curve; see [dtwPlotThreeWay()];
- densitydisplays the cumulative cost landscape with the warping path overimposed; see [dtwPlotDensity()]
 - Additional parameters are passed to the plotting functions: use with care. - Parameters:
- x – dtw object, usually result of call to [dtw()] 
- d – dtw object, usually result of call to [dtw()] 
- xlab – label for the query axis 
- ylab – label for the reference axis 
- type – general style for the plot, see below 
- plot_type – type of line to be drawn, used as the type argument in the underlying plot call 
- ... – additional arguments, passed to plotting functions