Namespace Matrix¶

namespace
matrix
¶ Functions

af::array
slidingDotProduct
(af::array q, af::array t)¶ Calculates the sliding dot product of the time series ‘q’ against t.
 Return
 array Returns an array with as many elements as ‘t’ in the first dimension and as many elements as the last dimension of ‘q’ in the last dimension.
 Parameters
q
: Array whose first dimension is the length of the query time series and the last dimension is the number of time series to calculate.t
: Array with the second time series in the first dimension.

void
meanStdev
(af::array t, af::array &a, long m, af::array &mean, af::array &stdev)¶ Calculates the moving average and standard deviation of the time series ‘t’.
 Parameters
t
: Input time series. Multiple time series.a
: Auxiliary array to be used in the function calculateDistanceProfile. Use the overloaded method without this parameter.m
: Window size.mean
: Output array containing the moving average.stdev
: Output array containing the moving standard deviation.

void
meanStdev
(af::array t, long m, af::array &mean, af::array &stdev)¶ Calculates the moving average and standard deviation of the time series ‘t’.
 Parameters
t
: Input time series. Multiple time series.m
: Window size.mean
: Output array containing the moving average.stdev
: Output array containing the moving standard deviation.

af::array
generateMask
(long m, long batchSize, long batchStart, long tsLength, long nTimeSeries = 1)¶ Function to generate a band matrix of batchSizeXtsLength with the offset batchStart.
 Return
 af::array With the resulting band.
 Parameters
m
: Subsequence length used to generate a band of m/2 at each side.batchSize
: Size of the first dimension.batchStart
: Offset of the band matrix.tsLength
: Size of the second dimension of the matrix.nTimeSeries
: Number of time series to generate the mask for.

void
calculateDistanceProfile
(af::array qt, af::array a, af::array sum_q, af::array sum_q2, af::array mean_t, af::array sigma_t, af::array mask, af::array &distance, af::array &index)¶ Calculates the distance between ‘q’ and the time series ‘t’, which produced the sliding. Multiple queries can be computed simultaneously in the last dimension of ‘q’.
 Parameters
qt
: The sliding dot product of ‘q’ and ‘t’.a
: Auxiliary array computed using the meanStdev function. This array contains a precomputed fixed value to speed up the distance calculation.sum_q
: Sum of the values contained in ‘q’.sum_q2
: Sum of squaring the values contained in ‘q’.mean_t
: Moving average of ‘t’ using a window size equal to the number of elements in ‘q’.sigma_t
: Moving standard deviation of ‘t’ using a window size equal to the number of elements in ‘q’.mask
: Mask band matrix to filter the trivial match of a subsequence with itself.distance
: Resulting minimal distance.index
: Position where the minimum is occurring.

void
calculateDistanceProfile
(af::array qt, af::array a, af::array sum_q, af::array sum_q2, af::array mean_t, af::array sigma_t, af::array &distance, af::array &index)¶ Calculates the distance between ‘q’ and the time series ‘t’, which produced the sliding. Multiple queries can be computed simultaneously in the last dimension of ‘q’.
 Parameters
qt
: The sliding dot product of ‘q’ and ‘t’.a
: Auxiliary array computed using the meanStdev function. This array contains a precomputed fixed value to speed up the distance calculation.sum_q
: Sum of the values contained in ‘q’.sum_q2
: Sum of squaring the values contained in ‘q’.mean_t
: Moving average of ‘t’ using a window size equal to the number of elements in ‘q’.sigma_t
: Moving standard deviation of ‘t’ using a window size equal to the number of elements in ‘q’.distance
: Resulting minimal distance.index
: Position where the minimum is occurring.

void
mass
(af::array q, af::array t, af::array a, af::array mean_t, af::array sigma_t, af::array mask, af::array &distance, af::array &index)¶ Calculates the Mueen distance.
[1] ChinChia Michael Yeh, Yan Zhu, Liudmila Ulanova, Nurjahan Begum, Yifei Ding, Hoang Anh Dau, Diego Furtado Silva, Abdullah Mueen, Eamonn Keogh (2016). Matrix Profile I: All Pairs Similarity Joins for Time Series: A Unifying View that Includes Motifs, Discords and Shapelets. IEEE ICDM 2016.
 Parameters
q
: Array whose first dimension is the length of the query time series and the last dimension is the number of time series to calculate.t
: Array with the second time series in the first dimension.a
: Auxiliary array computed using the meanStdev function. This array contains a precomputed fixed value to speed up the distance calculation.mean_t
: Moving average of ‘t’ using a window size equal to the number of elements in ‘q’.sigma_t
: Moving standard deviation of ‘t’ using a window size equal to the number of elements in ‘q’.mask
: Specifies the elements that should not be considered in the computation.distance
: Resulting minimal distance.index
: Position where the minimum is occurring.

void
mass
(af::array q, af::array t, af::array a, af::array mean_t, af::array sigma_t, af::array &distance, af::array &index)¶ Calculates the Mueen distance.
 Parameters
q
: Array whose first dimension is the length of the query time series and the last dimension is the number of time series to calculate.t
: Array with the second time series in the first dimension.a
: Auxiliary array computed using the meanStdev function. This array contains a precomputed fixed value to speed up the distance calculation.mean_t
: Moving average of ‘t’ using a window size equal to the number of elements in ‘q’.sigma_t
: Moving standard deviation of ‘t’ using a window size equal to the number of elements in ‘q’.distance
: Resulting minimal distance.index
: Position where the minimum is occurring.

void
stomp
(af::array ta, af::array tb, long m, af::array &profile, af::array &index)¶ STOMP algorithm to calculate the matrix profile between ‘ta’ and ‘tb’ using a subsequence length of ‘m’.
[1] Yan Zhu, Zachary Zimmerman, Nader Shakibay Senobari, ChinChia Michael Yeh, Gareth Funning, Abdullah Mueen, Philip Brisk and Eamonn Keogh (2016). Matrix Profile II: Exploiting a Novel Algorithm and GPUs to break the one Hundred Million Barrier for Time Series Motifs and Joins. IEEE ICDM 2016.
 Parameters
ta
: Query time series.tb
: Reference time series.m
: Subsequence length.profile
: The matrix profile, which reflects the distance to the closer element of the subsequence from ‘ta’ in ‘tb’.index
: The matrix profile index, which points to where the aforementioned minimum is located.

void
stomp
(af::array t, long m, af::array &profile, af::array &index)¶ STOMP algorithm to calculate the matrix profile between ‘t’ and itself using a subsequence length of ‘m’. This method filters the trivial matches.
[1] Yan Zhu, Zachary Zimmerman, Nader Shakibay Senobari, ChinChia Michael Yeh, Gareth Funning, Abdullah Mueen, Philip Brisk and Eamonn Keogh (2016). Matrix Profile II: Exploiting a Novel Algorithm and GPUs to break the one Hundred Million Barrier for Time Series Motifs and Joins. IEEE ICDM 2016.
 Parameters
t
: Query and reference time series.m
: Subsequence length.profile
: The matrix profile, which reflects the distance to the closer element of the subsequence from ‘t’ in a different location of itself.index
: The matrix profile index, which points to where the aforementioned minimum is located.

void
findBestNMotifs
(af::array profile, af::array index, long m, long n, af::array &motifs, af::array &motifsIndices, af::array &subsequenceIndices, bool selfJoin = false)¶ This function extracts the best N motifs from a previously calculated matrix profile.
 Parameters
profile
: The matrix profile containing the minimum distance of each subsequence.index
: The matrix profile index containing where each minimum occurs.m
: Subsequence length value used to calculate the input matrix profile.n
: Number of motifs to extract.motifs
: The distance of the best N motifs.motifsIndices
: The indices of the best N motifs.subsequenceIndices
: The indices of the query sequences that produced the minimum reported in the motifs output array.selfJoin
: Indicates whether the input profile comes from a self join operation or not. It determines whether the mirror similar region is included in the output or not.

void
findBestNDiscords
(af::array profile, af::array index, long m, long n, af::array &discords, af::array &discordsIndices, af::array &subsequenceIndices, bool selfJoin = false)¶ This function extracts the best N discords from a previously calculated matrix profile.
 Parameters
profile
: The matrix profile containing the minimum distance of each subsequence.index
: The matrix profile index containing where each minimum occurs.m
: Subsequence length value used to calculate the input matrix profile.n
: Number of discords to extract.discords
: The distance of the best N discords.discordsIndices
: The indices of the best N discords.subsequenceIndices
: The indices of the query sequences that produced the discords reported in the discords output array.selfJoin
: Indicates whether the input profile comes from a self join operation or not. It determines whether the mirror similar region is included in the output or not.

af::array