# Sample data
data(uciCT)
# Obtain an average for the first 5 time series
dtw.avg <- DBA(CharTraj[1:5], CharTraj[[1]], trace = TRUE)
# Plot
matplot(do.call(cbind, CharTraj[1:5]), type = "l")
points(dtw.avg)
# Change the provided order
dtw.avg2 <- DBA(CharTraj[5:1], CharTraj[[1]], trace = TRUE)
# Same result?
all(dtw.avg == dtw.avg2)
## Not run:
# #### Running DBA with parallel support
# # For such a small dataset, this is probably slower in parallel
# require(doParallel)
#
# # Create parallel workers
# cl <- makeCluster(detectCores())
# invisible(clusterEvalQ(cl, library(dtwclust)))
# registerDoParallel(cl)
#
# # DTW Average
# cen <- DBA(CharTraj[1:5], CharTraj[[1]], trace = TRUE)
#
# # Stop parallel workers
# stopCluster(cl)
#
# # Return to sequential computations
# registerDoSEQ()
# ## End(Not run)
Run the code above in your browser using DataLab