Learn R Programming

IncDTW (version 1.0.2)

dec_dm: dec_dm

Description

wrapper function for the C++ implementation of an decremental calculation of the warping path subject to a given direction matrix for dynamic time warping

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 C of the optimal path

jj

indices of Q of the optimal path

diffp

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

References

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

Run this code
# NOT RUN {
Q <- cos(1:100)
C <- cumsum(rnorm(80))
# the ordinary calculation
result_base <- dtw(Q=Q, C=C, return_diffM = FALSE) 

# the ordinary calculation without the last 4 observations
result_decr <- dtw(Q=Q, C=C[1:(length(C) - 4)], return_diffM = FALSE) 
# 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)

# }

Run the code above in your browser using DataLab