dtwPlotDensity: Display the cumulative cost density with the warping path...

View source: R/plot.dtw.R

dtwPlotDensityR Documentation

Display the cumulative cost density with the warping path overimposed

Description

The plot is based on the cumulative cost matrix. It displays the optimal alignment as a "ridge" in the global cost landscape.

Usage

dtwPlotDensity(
  d,
  normalize = FALSE,
  xlab = "Query index",
  ylab = "Reference index",
  ...
)

Arguments

d

an alignment result, object of class dtw

normalize

show per-step average cost instead of cumulative cost

xlab

label for the query axis

ylab

label for the reference axis

...

additional parameters forwarded to plotting functions

Details

The alignment must have been constructed with the keep.internals=TRUE parameter set.

If normalize is TRUE, the average cost per step is plotted instead of the cumulative one. Step averaging depends on the stepPattern() used.

See Also

Other plot: dtwPlotThreeWay(), dtwPlotTwoWay(), dtwPlot()

Examples


## A study of the "Itakura" parallelogram
##
## A widely held misconception is that the "Itakura parallelogram" (as
## described in the original article) is a global constraint.  Instead,
## it arises from local slope restrictions. Anyway, an "itakuraWindow",
## is provided in this package. A comparison between the two follows.

## The local constraint: three sides of the parallelogram are seen
idx<-seq(0,6.28,len=100);
query<-sin(idx)+runif(100)/10;
reference<-cos(idx)

ita <- dtw(query,reference,keep=TRUE,step=typeIIIc)
dtwPlotDensity(ita, main="Slope-limited asymmetric step (Itakura)")

## Symmetric step with global parallelogram-shaped constraint. Note how
## long (>2 steps) horizontal stretches are allowed within the window.

dtw(query,reference,keep=TRUE,window=itakuraWindow)->ita;
dtwPlotDensity(ita,
        main="Symmetric step with Itakura parallelogram window")


dtw documentation built on Sept. 20, 2022, 1:06 a.m.