Computes the contrast profile of two (classes of) time series.
contrast(
negative_data,
positive_data,
window_size,
positive_matrix = NULL,
exclusion_zone = 0.5,
distance = c("euclidean", "pearson"),
n_workers = 1L,
progress = TRUE
)
Returns a list
with the contrast_profile
, plato
, plato_nn
, plato_idx
, plato_nn_idx
, w
, ez
, euclidean
values
Required. Any 1-dimension series of numbers (matrix
, vector
, ts
etc.) where the pattern is not present
Required. Any 1-dimension series of numbers (matrix
, vector
, ts
etc.) where the pattern is present
Required. An integer defining the rolling window size.
Optional. A precomputed self-similar matrix profile of the positive data.
A numeric. Defines the size of the area around the rolling window that will be ignored to avoid
trivial matches. Default is 0.5
, i.e., half of the window_size
.
A string. Currently accepts euclidean
and pearson
. Defaults to euclidean
.
An integer. The number of threads using for computing. Defaults to 1
.
A logical. If TRUE
(the default) will show a progress bar. Useful for long computations.
This algorithm returns the contrast profile of two time series, which shows the position of patters that are similar in the positive data, but at the same time very dissimilar in the negative data. In other words, this means that such a pattern represents well positive data and may be taken as a "signature" of that class. More information can be found in the references.
R. Mercer, S. Alaee, A. Abdoli, S. Singh, A. Murillo and E. Keogh, "Matrix Profile XXIII: Contrast Profile: A Novel Time Series Primitive that Allows Real World Classification," 2021 IEEE International Conference on Data Mining (ICDM), 2021, pp. 1240-1245, doi: 10.1109/ICDM51629.2021.00151.
cp <- contrast(motifs_discords_small, rev(motifs_discords_small), 50)
Run the code above in your browser using DataLab