Title: | Matrix Profile |
---|---|
Description: | A simple and the early stage package for matrix profile based on the paper of Chin-Chia Michael Yeh, Yan Zhu, Liudmila Ulanova, Nurjahan Begum, Yifei Ding, Hoang Anh Dau, Diego Furtado Silva, Abdullah Mueen, and Eamonn Keogh (2016) <DOI:10.1109/ICDM.2016.0179>. This package calculates all-pairs-similarity for a given window size for time series data. |
Authors: | Donghwan Kim |
Maintainer: | Donghwan Kim <[email protected]> |
License: | GPL-3 |
Version: | 0.5.0 |
Built: | 2024-11-12 02:38:51 UTC |
Source: | https://github.com/cran/matrixProfile |
Calculates a sliding dot prodocts of given data.
mass(q, t)
mass(q, t)
q |
A query data for dot product. |
t |
A timeseries data for analysis. |
Dot products between query and all subsequences in Timeseries. In the paper, we can implicitly construct a distance matrix with this output values that are the result of these dot products.
Donghwan Kim
[email protected]
[email protected]
[email protected]
Yeh, C. C. M., Zhu, Y., Ulanova, L., Begum, N., Ding, Y., Dau, H. A., ... & Keogh, E. (2016) <DOI:10.1109/ICDM.2016.0179>. 2016 IEEE 16th International Conference on Data Mining (ICDM), Barcelona, 2016, pp. 1317-1322.
https://www.cs.unm.edu/~mueen/MASS_V2.m
dt = AirPassengers dt = as.vector(dt) par(mfrow = c(2,1)) plot(dt, type = "l") dm <- mass(q = dt[1:10], t = dt[-c(1:10)]) plot(dm, tyep = "l")
dt = AirPassengers dt = as.vector(dt) par(mfrow = c(2,1)) plot(dt, type = "l") dm <- mass(q = dt[1:10], t = dt[-c(1:10)]) plot(dm, tyep = "l")
Calculates moving mean of input data.
movmean(x = x, w = w)
movmean(x = x, w = w)
x |
A given input data. |
w |
A sliding window of length w. |
An array of local w-point mean values, where each mean is calculated over a sliding window of length w across neighboring elements of x. The window size is automatically truncated at the endpoints when there are not enough elements to fill the window. When the window is truncated, the average is taken over only the elements that fill the window. Output is the same size as x.
Donghwan Kim
[email protected]
[email protected]
[email protected]
https://kr.mathworks.com/help/matlab/ref/movmean.html?lang=en
x <- 1:10 movmean(x, 3)
x <- 1:10 movmean(x, 3)
Calculates moving sample standard deviation of input data.
movstd(x = x, w = w)
movstd(x = x, w = w)
x |
A given input data. |
w |
A sliding window of length w. |
An array of local w-point sample standard deviation values, where each sample standard deviation is calculated over a sliding window of length w across neighboring elements of x. The window size is automatically truncated at the endpoints when there are not enough elements to fill the window. When the window is truncated, the standard deviation is taken over only the elements that fill the window. Output is the same size as x.
Donghwan Kim
[email protected]
[email protected]
[email protected]
https://kr.mathworks.com/help/matlab/ref/movstd.html?lang=en
x <- 1:10 movstd(x, 3)
x <- 1:10 movstd(x, 3)
Calculates a matrix profile of given data using STAMP algorithm.
stamp(q, t, by = 10, isPlot = FALSE)
stamp(q, t, by = 10, isPlot = FALSE)
q |
A query data for dot product. |
t |
A timeseries data for analysis. |
by |
A parameter that indicates the progress of the process in the process of calculating the matrix profile. For example, if |
isPlot |
A parameter that determines whether or not to draw a plot in the middle of calculating a matrix profile. The default value is |
The matrix profile is calculated by the self join method using the STAMP algorithm. One of the key features of the STAMP algorithm is the attribute anytime. In other words, because the matrix profile is computed rather than randomly, the computation speed is the same, but it is quickly optimized.
An object of class stamp.models
.
MP |
A matrix profile computed by given data. |
MPI |
A matrix profile index computed by given data. |
MTI |
A motif index of matrix profile. Unlike in the original paper, it denotes the pair of motif index with the smallest value of matrix profile. |
This package is an early version and will be updated in the neae future. Also note that it is very slow for data with more than 10,000 data points. Since it is not optimized basic functions(e.g. movmean
, movstd
) for computation and is due to R
's own limitations.
Donghwan Kim
[email protected]
[email protected]
[email protected]
Yeh, C. C. M., Zhu, Y., Ulanova, L., Begum, N., Ding, Y., Dau, H. A., ... & Keogh, E. (2016) <DOI:10.1109/ICDM.2016.0179>. 2016 IEEE 16th International Conference on Data Mining (ICDM), Barcelona, 2016, pp. 1317-1322.
http://www.cs.ucr.edu/~eamonn/MatrixProfile.html
mass
(in package matrixProfile)
# data input dt = AirPassengers dt = as.vector(dt) # generates matrix profile stamp <- stamp(q = dt[1:12], t = dt[-c(1:12)]) # plotting par(mfrow = c(2,1)) plot(dt, type = "l", main = "Original Timeseries") plot(stamp$MP, type = "l", main = "Matrix Profile", xlim = c(0, length(dt)))
# data input dt = AirPassengers dt = as.vector(dt) # generates matrix profile stamp <- stamp(q = dt[1:12], t = dt[-c(1:12)]) # plotting par(mfrow = c(2,1)) plot(dt, type = "l", main = "Original Timeseries") plot(stamp$MP, type = "l", main = "Matrix Profile", xlim = c(0, length(dt)))
Calculates sample standard deviation of input data.
std(x)
std(x)
x |
A given input data. |
This function is slightly different from the base function sd
.
An sample standard deviation of given data.
Donghwan Kim
[email protected]
[email protected]
[email protected]
https://en.wikipedia.org/wiki/Standard_deviation
x <- 1:10 sd(x) # for comparison std(x) # see difference
x <- 1:10 sd(x) # for comparison std(x) # see difference