#### Running TADPole with parallel support
require(doParallel)
# Load data
data(uciCT)
# Reinterpolate to same length and coerce as matrix
data <- t(sapply(CharTraj, reinterpolate, newLength = 180))
# Create parallel workers
cl <- makeCluster(detectCores())
invisible(clusterEvalQ(cl, library(dtwclust)))
registerDoParallel(cl)
# Cluster
kc.tadp <- TADPole(data, k = 20, window.size = 20, dc = 1.5)
# Stop parallel workers
stopCluster(cl)
# Return to sequential computations
registerDoSEQ()
# Compute Rand Index
cat("Rand index for TADPole:", randIndex(kc.tadp$cl, CharTrajLabels), "\n\n")
Run the code above in your browser using DataLab