mass_pre_w: Precomputes several values used on MASS

Description Usage Arguments Value References See Also Examples

View source: R/mass-pre-w.R

Description

Precomputes several values used on MASS

Usage

1
mass_pre_w(data, query = NULL, window_size, weight)

Arguments

data

a vector or a matrix of numeric. Reference Time Series.

query

a vector or a matrix of numeric. Query Time Series (default is NULL).

window_size

an int. Sliding window size.

weight

a vector of numeric with the same length of the window_size.

Value

Returns window_size, data_fft, data_size, data_mean, data_sd, data_pre, weight

References

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

See Also

mass_weighted() for using precomputed values.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
w <- mp_toy_data$sub_len
ref_data <- mp_toy_data$data[, 1]
query_data <- mp_toy_data$data[, 1]
weight <- c(
  rep(1, mp_toy_data$sub_len / 3), rep(0.5, mp_toy_data$sub_len / 3),
  rep(1, mp_toy_data$sub_len / 3)
)

pre <- tsmp:::mass_pre_w(ref_data, query_data, w, weight)

dp <- list()
for (i in 1:(pre$data_size - w + 1)) {
  dp[[i]] <- tsmp:::mass_weighted(
    query_data[i:(i - 1 + w)], pre$window_size, pre$data_fft, pre$data_size,
    pre$data_mean, pre$data_sd, pre$data_pre, pre$weight
  )
}

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