This score function is useful for testing several values of n_bits for MDL discretization and checking against a known set of indexes. This increase the probability of better results on relevant subsequence extraction.

salient_score(.mp, gtruth, verbose = getOption("tsmp.verbose", 2))



a Matrix Profile object.


a vector of integers with the indexes of relevant subsequences.


an int. (Default is 2).


Returns a list with f_score, precision, recall and bits used in the algorithm.


  • Yeh CCM, Van Herle H, Keogh E. Matrix profile III: The matrix profile allows visualization of salient subsequences in massive time series. Proc - IEEE Int Conf Data Mining, ICDM. 2017;579-88.

  • Hu B, Rakthanmanon T, Hao Y, Evans S, Lonardi S, Keogh E. Discovering the Intrinsic Cardinality and Dimensionality of Time Series Using MDL. In: 2011 IEEE 11th International Conference on Data Mining. IEEE; 2011. p. 1086-91.



# toy example
data <- mp_toy_data$data[, 1]
mp <- tsmp(data, window_size = 30, verbose = 0)
mps <- salient_subsequences(mp, n_bits = c(4, 6, 8), verbose = 0)
#> Error in salient_subsequences(mp, n_bits = c(4, 6, 8), verbose = 0): First argument must be an object of class `MatrixProfile`.
label_idx <- seq(2, 500, by = 110) # fake data
salient_score(mps, label_idx, verbose = 0)
#> Error in "Salient" %in% class(.mp): object 'mps' not found