distancematrix.consumer.threshold_counter

Module Contents

Classes

ThresholdCounter

Consumer that counts the number of values in each column of the distancematrix that are below

DistancedThresholdCounter

Consumer that counts the number of values in each column of the distancematrix that are below

class distancematrix.consumer.threshold_counter.ThresholdCounter(thresholds)

Bases: distancematrix.consumer.abstract_consumer.AbstractConsumer

Consumer that counts the number of values in each column of the distancematrix that are below or equal to specified thresholds.

This consumer counts values as they are passed and does not extrapolate or keep information about which values were already counted. Specifically: partial calculations will result in counts of the produced values, and passing the same diagonals multiple time could result in double counts.

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

class distancematrix.consumer.threshold_counter.DistancedThresholdCounter(thresholds, exclusion)

Bases: distancematrix.consumer.abstract_consumer.AbstractConsumer

Consumer that counts the number of values in each column of the distancematrix that are below or equal to specified thresholds, with the added restriction of only counting elements that are at least a number of values apart from each other.

This consumer does not support diagonal calculations.

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

abstract 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