MCPcopy Index your code
hub / github.com/DynamicTimeWarping/dtw-python / dtwPlotDensity

Function dtwPlotDensity

dtw/dtwPlot.py:321–409  ·  view source on GitHub ↗

Display the cumulative cost density with the warping path overimposed The plot is based on the cumulative cost matrix. It displays the optimal alignment as a “ridge” in the global cost landscape. **Details** The alignment must have been constructed with the ``keep_internals=True`` parameter set.

(d, normalize=False,
                   xlab="Query index",
                   ylab="Reference index", **kwargs)

Source from the content-addressed store, hash-verified

319
320
321def dtwPlotDensity(d, normalize=False,
322 xlab="Query index",
323 ylab="Reference index", **kwargs):
324 # IMPORT_RDOCSTRING dtwPlotDensity
325 """Display the cumulative cost density with the warping path overimposed
326
327The plot is based on the cumulative cost matrix. It displays the optimal
328alignment as a “ridge” in the global cost landscape.
329
330**Details**
331
332The alignment must have been constructed with the
333``keep_internals=True`` parameter set.
334
335If ``normalize`` is ``True``, the *average* cost per step is plotted
336instead of the cumulative one. Step averaging depends on the
337[stepPattern()] used.
338
339Parameters
340----------
341d :
342 an alignment result, object of class `dtw`
343normalize :
344 show per-step average cost instead of cumulative cost
345xlab :
346 label for the query axis
347ylab :
348 label for the reference axis
349... :
350 additional parameters forwarded to plotting functions
351
352Examples
353--------
354>>> from dtw import *
355
356A study of the "Itakura" parallelogram
357
358A widely held misconception is that the "Itakura parallelogram" (as
359described in the original article) is a global constraint. Instead,
360it arises from local slope restrictions. Anyway, an "itakuraWindow",
361is provided in this package. A comparison between the two follows.
362
363The local constraint: three sides of the parallelogram are seen
364
365>>> (query, reference) = dtw_test_data.sin_cos()
366>>> ita = dtw(query, reference, keep_internals=True, step_pattern=typeIIIc)
367
368>>> dtwPlotDensity(ita) # doctest: +SKIP
369
370Symmetric step with global parallelogram-shaped constraint. Note how
371long (>2 steps) horizontal stretches are allowed within the window.
372
373>>> ita = dtw(query, reference, keep_internals=True, window_type=itakuraWindow)
374
375>>> dtwPlotDensity(ita) # doctest: +SKIP
376
377"""
378 # ENDIMPORT

Callers 1

dtwPlotFunction · 0.85

Calls 1

plotMethod · 0.45

Tested by

no test coverage detected