1.8. Namespace Matrix

class Matrix

Khiva Matrix Profile class containing matrix profile methods.

Public Static Functions

static Tuple<KhivaArray, KhivaArray, KhivaArray> Khiva.Matrix.FindBestNDiscords(KhivaArray profile, KhivaArray index, long m, long n, bool selfJoin = false)

Primitive of the findBestNDiscords function.

Return
Tuple with the distance of the best N discords, the indices of the best N discords and the indices of the query sequences that produced the “N” bigger discords.
Parameters
  • profile: The matrix profile containing the minimum distance of each subsequence.
  • index: The matrix profile index containing the index of the most similar subsequence.
  • m: Length of the matrix profile.
  • n: Number of discords to extract.
  • 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.

static Tuple<KhivaArray, KhivaArray, KhivaArray> Khiva.Matrix.FindBestNMotifs(KhivaArray profile, KhivaArray index, long m, long n, bool selfJoin = false)

Primitive of the findBestNMotifs function.

Return
Tuple with the distance of the best N motifs, the indices of the best N motifs, the indices of the query sequences that produced the minimum reported in the motifs.
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.
  • 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.

static Tuple<KhivaArray, KhivaArray> Khiva.Matrix.Stomp(KhivaArray tssa, KhivaArray tssb, long m)

Primitive of the STOMP algorithm.

[1] Yan Zhu, Zachary Zimmerman, Nader Shakibay Senobari, Chin-Chia 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.

Return
Tuple with the matrix profile, which has the distance to the closer element of the subsequence from ‘tssa’ in ‘tssb’ and the matrix profile index, which points to where the aforementioned minimum is located.
Parameters
  • tssa: Query time series.
  • tssb: Reference time series.
  • m: Pointer to a long with the length of the subsequence.

static Tuple<KhivaArray, KhivaArray> Khiva.Matrix.StompSelfJoin(KhivaArray tss, long m)

Primitive of the STOMP self join algorithm.

[1] Yan Zhu, Zachary Zimmerman, Nader Shakibay Senobari, Chin-Chia 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.

Return
Tuple with the matrix profile, which has the distance to the closer element of the subsequence from ‘tss’ in a different location of itself and the matrix profile index, which points to where the aforementioned minimum is located.
Parameters
  • tss: Query and reference time series.
  • m: Pointer to a long with the length of the subsequence.

static KhivaArray Khiva.Matrix.Mass(KhivaArray query, KhivaArray tss)

Mueen’s Algorithm for Similarity Search.

The result has the following structure:

  • 1st dimension corresponds to the index of the subsequence in the time series.
  • 2nd dimension corresponds to the number of queries.
  • 3rd dimension corresponds to the number of time series.

For example, the distance in the position (1, 2, 3) correspond to the distance of the third query to the fourth time series for the second subsequence in the time series.

[1] Yan Zhu, Zachary Zimmerman, Nader Shakibay Senobari, Chin-Chia 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.

Return
Resulting distances.
Parameters
  • query: Array whose first dimension is the length of the query time series and the second dimension is the number of queries.
  • tss: Array whose first dimension is the length of the time series and the second dimension is the number of time series.

static Tuple<KhivaArray, KhivaArray> Khiva.Matrix.FindBestNOccurrences(KhivaArray query, KhivaArray tss, long n)

Calculates the N best matches of several queries in several time series. The result has the following structure:

  • 1st dimension corresponds to the nth best match.
  • 2nd dimension corresponds to the number of queries.
  • 3rd dimension corresponds to the number of time series.

For example, the distance in the position (1, 2, 3) corresponds to the second best distance of the third query in the fourth time series. The index in the position (1, 2, 3) is the is the index of the subsequence which leads to the second best distance of the third query in the fourth time series.

Return
Tuple with the resulting distances and indexes.
Parameters
  • query: Array whose first dimension is the length of the query time series and the second dimension is the number of queries.
  • tss: Array whose first dimension is the length of the time series and the second dimension is the number of time series.
  • n: Number of matches to return.