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)
| 319 | |
| 320 | |
| 321 | def 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 | |
| 327 | The plot is based on the cumulative cost matrix. It displays the optimal |
| 328 | alignment as a “ridge” in the global cost landscape. |
| 329 | |
| 330 | **Details** |
| 331 | |
| 332 | The alignment must have been constructed with the |
| 333 | ``keep_internals=True`` parameter set. |
| 334 | |
| 335 | If ``normalize`` is ``True``, the *average* cost per step is plotted |
| 336 | instead of the cumulative one. Step averaging depends on the |
| 337 | [stepPattern()] used. |
| 338 | |
| 339 | Parameters |
| 340 | ---------- |
| 341 | d : |
| 342 | an alignment result, object of class `dtw` |
| 343 | normalize : |
| 344 | show per-step average cost instead of cumulative cost |
| 345 | xlab : |
| 346 | label for the query axis |
| 347 | ylab : |
| 348 | label for the reference axis |
| 349 | ... : |
| 350 | additional parameters forwarded to plotting functions |
| 351 | |
| 352 | Examples |
| 353 | -------- |
| 354 | >>> from dtw import * |
| 355 | |
| 356 | A study of the "Itakura" parallelogram |
| 357 | |
| 358 | A widely held misconception is that the "Itakura parallelogram" (as |
| 359 | described in the original article) is a global constraint. Instead, |
| 360 | it arises from local slope restrictions. Anyway, an "itakuraWindow", |
| 361 | is provided in this package. A comparison between the two follows. |
| 362 | |
| 363 | The 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 | |
| 370 | Symmetric step with global parallelogram-shaped constraint. Note how |
| 371 | long (>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 |