ucrdtw_mv: UCR DTW Algorithm matrix-vector method

View source: R/ucrdtw.R

ucrdtw_mvR Documentation

UCR DTW Algorithm matrix-vector method

Description

This implementation of the UCR Suite command line utility, takes an R numeric matrix as data input and an R numeric vector for the query. The default behaviour differs from the other methods, in that it does not perform a sliding window search for a match. Instead it is designed to find a best match for a query in a reference set of time-series of the same length as the query. This is useful, for example, when comparing a time-series of undetermined class to a labelled reference set of classified time-series.

Usage

ucrdtw_mv(data, query, dtwwindow, epoch = 1e+05, skip = TRUE, byrow = FALSE)

Arguments

data

numeric matrix containing data

query

numeric vector containing the query. This determines the query length.

dtwwindow

double; Size of the warping window size (as a proportion of query length). The DTW calculation in 'rucrdtw' uses a symmetric Sakoe-Chiba band. See Giorgino (2009) for a general coverage of warping window constraints.

epoch

int defaults to 1e5, should be \le 1e6. This is the size of the data chunk that is processed at once. All cumulative values in the algorithm will be restarted after epoch iterations to reduce floating point errors in these values.

skip

boolean; defaults to TRUE. If TRUE bound calculations and if necessary, distance calculations, are only performed on non-overlapping segments of the data (i.e. multiples of length(query)). This is useful if data is a set of multiple reference time series, each of length length(query). The location returned when skipping is the index of the subsequence.

byrow

logical; If TRUE rows in data represent time-series, columns time-points

Value

a ucrdtw object. A list containing the following elements

  • location: The row or column number of the nearest neighbor of the given query in the data set.

  • distance: The DTW distance between the nearest neighbor and the query.

  • prunedKim: Percentage of subsequences that were pruned based on the LB-Kim criterion.

  • prunedKeogh: Percentage of subsequences that were pruned based on the LB-Keogh-EQ criterion.

  • prunedKeogh2: Percentage of subsequences that were pruned based on the LB-Keogh-EC criterion.

  • dtwCalc: Percentage of subsequences for which the full DTW distance was calculated.

References

Giorgino, Toni (2009). Computing and Visualizing Dynamic Time Warping Alignments in R: The dtw Package. Journal of Statistical Software, 31(7), 1-24, doi:\Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v031.i07")}.

Examples

#load example data
data("synthetic_control")
query <- synthetic_control[5,]
#run query
ucrdtw_mv(synthetic_control, query, 0.05, byrow = TRUE)

rucrdtw documentation built on Aug. 24, 2023, 5:06 p.m.