mass_v2: Calculates the distance profile using MASS_V2 algorithm

Description Usage Arguments Value References See Also Examples

View source: R/mass_v2.R

Description

Mueen's Algorithm for Similarity Search is The Fastest Similarity Search Algorithm for Time Series Subsequences under Euclidean Distance and Correlation Coefficient.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
mass_v2(
  query_window,
  window_size,
  data_fft,
  data_size,
  data_mean,
  data_sd,
  query_mean,
  query_sd,
  ...
)

Arguments

query_window

a vector of numeric. Query window.

window_size

an int. Sliding window size.

data_fft

precomputed data product.

data_size

an int. The length of the reference data.

data_mean

precomputed data moving average.

data_sd

precomputed data moving standard deviation.

query_mean

precomputed query average.

query_sd

precomputed query standard deviation.

...

just a placeholder to catch unused parameters.

Value

Returns the distance_profile for the given query and the last_product for STOMP algorithm.

References

Website: https://www.cs.unm.edu/~mueen/FastestSimilaritySearch.html

See Also

mass_pre() to precomputation of input values.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
w <- mp_toy_data$sub_len
ref_data <- mp_toy_data$data[, 1]
query_data <- mp_toy_data$data[, 1]
d_size <- length(ref_data)
q_size <- length(query_data)

pre <- tsmp:::mass_pre(ref_data, query_data, w)

dp <- list()
for (i in 1:(d_size - w + 1)) {
  dp[[i]] <- tsmp:::mass_v2(
    query_data[i:(i - 1 + w)], pre$window_size,
    pre$data_fft, pre$data_size, pre$data_mean, pre$data_sd,
    pre$query_mean[i], pre$query_sd[i]
  )
}

franzbischoff/tsmp documentation built on March 9, 2020, 6:01 a.m.