dec_dm: Decrement the Warping Path

View source: R/dtw.R

dec_dmR Documentation

Decrement the Warping Path

Description

Update the warping path to omit observations of the alignment of two time series.

Usage

dec_dm(dm, Ndec, diffM = NULL)

Arguments

dm

direction matrix, output from dtw(Q=Q, C=C, ws=ws)

Ndec

integer, number of observations (columns) to be reduced

diffM

matrix of differences

Value

wp

warping path

ii

indices of Q of the optimal path

jj

indices of C of the optimal path

diffp

path of differences (only returned if diffM is not NULL)

References

  • Leodolter, M.; Pland, C.; Brändle, N; IncDTW: An R Package for Incremental Calculation of Dynamic Time Warping. Journal of Statistical Software, 99(9), 1-23. doi: 10.18637/jss.v099.i09

  • Sakoe, H.; Chiba, S., Dynamic programming algorithm optimization for spoken word recognition, Acoustics, Speech, and Signal Processing [see also IEEE Transactions on Signal Processing], IEEE Transactions on , vol.26, no.1, pp. 43-49, Feb 1978. http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=1163055

Examples

Q <- cos(1:100)
C <- cumsum(rnorm(80))
# the ordinary calculation
result_base <- dtw(Q=Q, C=C, return_wp = TRUE) 

# the ordinary calculation without the last 4 observations
result_decr <- dtw(Q=Q, C=C[1:(length(C) - 4)], return_wp = TRUE) 
# the decremental step: reduce C for 4 observation
result_decr2 <- dec_dm(result_base$dm, Ndec = 4) 

# compare ii, jj and wp of result_decr and those of 
result_decr$ii
result_decr2$ii
identical(result_decr$ii, result_decr2$ii)

result_decr$jj
result_decr2$jj
identical(result_decr$jj, result_decr2$jj)

result_decr$wp
result_decr2$wp
identical(result_decr$wp, result_decr2$wp)



IncDTW documentation built on March 18, 2022, 6:43 p.m.