MPdist is a recently introduced distance measure which considers two time series to be similar if they share many similar subsequences, regardless of the order of matching subsequences. It was demonstrated in that MPdist is robust to spikes, warping, linear trends, dropouts, wandering baseline and missing values, issues that are common outside of benchmark datasets.

mpdist(
  ref_data,
  query_data,
  window_size,
  type = c("simple", "vector"),
  thr = 0.05
)

Arguments

ref_data

a matrix or a vector. The reference data

query_data

a matrix or a vector. The query data

window_size

an int. Size of the sliding window.

type

the type of result. (Default is simple). See details.

thr

threshold for MPdist. (Default is 0.05). Don't change this unless you know what you are doing.

Value

Returns the distance of two time series or a vector containing the distance between all sliding windows.

Details

MPdist returns the distance of two time series or a vector containing the distance between all sliding windows. If argument type is set to vector, the vector is returned.

References

  • Gharghabi S, Imani S, Bagnall A, Darvishzadeh A, Keogh E. Matrix Profile XII: MPdist: A Novel Time Series Distance Measure to Allow Data Mining in More Challenging Scenarios. In: 2018 IEEE International Conference on Data Mining (ICDM). 2018.

Website: https://sites.google.com/site/mpdistinfo/

Examples

ref_data <- mp_toy_data$data[, 1]
qe_data <- mp_toy_data$data[, 2]
qd_data <- mp_toy_data$data[150:200, 1]
w <- mp_toy_data$sub_len

# distance between data of same size
deq <- mpdist(ref_data, qe_data, w)

# distance between data of different sizes
ddiff <- mpdist(ref_data, qd_data, w)
#> Error: Time series is too short relative to desired window size.

# distance vector between data of different sizes
ddvect <- mpdist(ref_data, qd_data, w, type = "vector")
#> Error in convert_data(data): Argument `data` cannot be `matrix` and must have a single dimension.Argument `data` cannot be `array` and must have a single dimension.