w <- mp_toy_data$sub_len
ref_data <- mp_toy_data$data[, 1]
# minimum example, data and query
nn <- dist_profile(ref_data, ref_data[1:w])
distance_profile <- sqrt(nn$distance_profile)
# data and indexed query
nn <- dist_profile(ref_data, ref_data, window_size = w, index = 10)
distance_profile <- sqrt(nn$distance_profile)
# recursive
nn <- NULL
for (i in seq_len(10)) {
nn <- dist_profile(ref_data, ref_data, nn, window_size = w, index = i)
}
# weighted
weight <- c(rep(1, w / 3), rep(0.5, w / 3), rep(0.8, w / 3)) # just an example
nn <- dist_profile(ref_data, ref_data,
window_size = w, index = 1, method = "weighted",
weight = weight
)
distance_profile <- sqrt(nn$distance_profile)
Run the code above in your browser using DataLab