distancematrix.consumer.contextual_matrix_profile

Module Contents

Classes

ContextualMatrixProfile

A consumer that constructs the contextual matrix profile. The contextual matrix profile is formed by

class distancematrix.consumer.contextual_matrix_profile.ContextualMatrixProfile(context_manager: AbstractContextManager, rb_scale_factor=2.0)

Bases: distancematrix.consumer.abstract_consumer.AbstractStreamingConsumer

A consumer that constructs the contextual matrix profile. The contextual matrix profile is formed by taking the minimum of rectangles across the full distance matrix (where the matrix profile takes the minimum across columns).

This consumer supports streaming if the provided context manager does.

initialise(self, dims, query_subseq, series_subseq)

Initialise this consumer.

Parameters
  • dims – the number of dimensions (data channels) this consumer will receive

  • query_subseq – the number of query subsequences (rows in the distance matrix)

  • series_subseq – the number of series subsequences (column in the distance matrix)

Returns

None

process_diagonal(self, diag, values)

Method called when a diagonal of the distance matrix is calculated.

The number of values on the diagonal might be less than the diagonal of the full matrix profile, this can occur when not enough data is available yet to calculate the entire distance matrix (typically for streaming when not enough data is available to fill the entire foreseen space).

Parameters
  • diagonal_index – index of the diagonal in range ]-num_query_subseq, num_series_subseq[, the main diagonal has index 0

  • values – array of shape (num_dimensions, num_values_on_diagonal) containing the distances

Returns

None

process_column(self, column_index, values)

Method called when a column of the distance matrix is calculated.

The number of values on the column might be less than the column of the full matrix profile, this can occur when not enough data is available yet to calculate the entire distance matrix (typically for streaming when not enough data is available to fill the entire foreseen space).

Parameters
  • column_index – index of the column, in range [0, series_subseq[

  • values – array of shape (num_dimensions, num_values_on_column) containing the distances

Returns

None

shift_series(self, amount)

Inform the consumer that the distance matrix has shifted in the series direction.

Parameters

amount – amount of subsequences that were shifted

Returns

None

shift_query(self, amount)

Inform the consumer that the distance matrix has shifted in the query direction.

Parameters

amount – amount of subsequences that were shifted

Returns

None

property match_index_query(self)
property match_index_series(self)
property distance_matrix(self)