Learn R Programming

dtwclust (version 1.0.0)

DBA: DTW Barycenter Averaging

Description

A global averaging method for time series under DTW (Petitjean, Ketterlin and Gancarski, 2011).

Usage

DBA(X, center = NULL, max.iter = 50, error.check = TRUE, trace = FALSE)

Arguments

X
A data matrix where each row is a time series. Optionally, a list where each element is a time series.
center
Optionally, a time series to use as reference. It must be a numeric vector. Defaults to a random series of X if NULL.
max.iter
Maximum number of iterations allowed.
error.check
Should inconsistencies in the data be checked?
trace
If TRUE, the current iteration is printed to screen.

Value

  • The average time series.

Details

This function tries to find the optimum average series between a group of time series in DTW space. Refer to the cited article for specific details on the algorithm.

If a given series reference is provided in center, the algorithm should always converge to the same result provided the rows of X keep the same values, although their order may change.

References

Petitjean F, Ketterlin A and Gancarski P (2011). ``A global averaging method for dynamic time warping, with applications to clustering.'' Pattern Recognition, 44(3), pp. 678 - 693. ISSN 0031-3203, http://dx.doi.org/10.1016/j.patcog.2010.09.013, http://www.sciencedirect.com/science/article/pii/S003132031000453X.

Examples

Run this code
# Sample data
data(uciCT)

# Obtain an average for the first 5 time series
dtw.avg <- DBA(CharTraj[1:5], CharTraj[[1]], trace = TRUE)
plot(dtw.avg, type="l")

# Change the provided order
dtw.avg2 <- DBA(CharTraj[5:1], CharTraj[[1]], trace = TRUE)
all(dtw.avg == dtw.avg2)

Run the code above in your browser using DataLab