minCost {DTWBI} R Documentation

## DTW-based methods for univariate signals

### Description

Finds the optimal alignment between two univariate time series based on DTW methods.

### Usage

minCost(X, Y, method, ...)


### Arguments

 X query vector Y response vector method "DTW", "DDTW", "AFBDTW", "DTW-D" ... additional arguments from functions dtw or dist_afbdtw

### Author(s)

Camille Dezecache, Hong T. T. Phan, Emilie Poisson-Caillault

### Examples

data(dataDTWBI)

# Plot query and reference
plot(X, type = "l", ylim = c(-5,3))
lines(1:length(X), Y, col = "red")

#= Align signals using DTW
align_dtw <- minCost(X, Y, method = "DTW")
#= Align signals using DDTW
align_ddtw <- minCost(X, Y, method = "DDTW")
#= Align signals using AFBDTW
align_afbdtw <- minCost(X, Y, method = "AFBDTW")
#= Align signals using DTW-D
align_dtwd <- minCost(X, Y, method = "DTW-D")

#= Plots
library(dtw)
dtwPlotTwoWay(d = align_dtw, xts <- X, yts = Y, main = "DTW")
dtwPlotTwoWay(d = align_ddtw, xts <- X, yts = Y, main = "DDTW")
dtwPlotTwoWay(d = align_afbdtw, xts <- X, yts = Y, main = "AFBDTW")
dtwPlotTwoWay(d = align_dtwd, xts <- X, yts = Y, main = "DTW-D")

#= Compare cost of each method
comparative_cost <- matrix(c(align_dtwnormalizedDistance, align_ddtwnormalizedDistance,
align_afbdtwnormalizedDistance, align_dtwdnormalizedDistance), ncol = 4)
colnames(comparative_cost) <- c("DTW", "DDTW", "AFBDTW", "DTW-D")
comparative_cost


[Package DTWBI version 1.1 Index]