distancematrix

Package Contents

Classes

AnytimeCalculator

Calculator that allows approximate calculations in a fraction of the time, but does not support

StreamingCalculator

Calculator that allows streaming data, but does not support anytime calculations.

class distancematrix.AnytimeCalculator(m, series, query=None, trivial_match_buffer=None)

Bases: distancematrix.calculator.AbstractCalculator

Calculator that allows approximate calculations in a fraction of the time, but does not support data streaming.

A calculator is repsonsible for managing consumers and generators for a distance matrix calculation. It provides a single point of interaction for the user.

add_generator(self, input_dim, generator)

Adds a generator that will use the data from the specified channel (from series/query).

Parameters
  • input_dim – index of the data channel

  • generator – the generator to add

Returns

the bound generator

calculate_diagonals(self, partial=1.0, print_progress=False)

Calculates diagonals of the distance matrix. The advantage of calculating diagonals is that values are spread over the entire distance matrix, which can provide a quick approximation for any consumer.

Parameters

partial – int for a number of values, float for relative number of values. The number of distance

matrix values that should be calculated (including the counts of previous diagonals calulated). :param print_progress: print progress to the console :return: None

class distancematrix.StreamingCalculator(m, series_window, query_window=None, n_dim=1, trivial_match_buffer=None)

Bases: distancematrix.calculator.AbstractCalculator

Calculator that allows streaming data, but does not support anytime calculations.

A calculator is repsonsible for managing consumers and generators for a distance matrix calculation. It provides a single point of interaction for the user.

add_generator(self, input_dim, generator)

Adds a generator that will use the data from the specified channel (from series/query).

Parameters
  • input_dim – index of the data channel

  • generator – the generator to add

Returns

the bound generator

append_series(self, values)

Add more data points to series.

As a side effect, the last calculated column index is shifted along with the data.

Parameters

values – 1D array for one data point on each channel, or 2D array of shape (num_dim, num_points)

Returns

None

append_query(self, values)

Add more data points to query. Cannot be used if performing a self join.

Note that appending query data does not adjust the last column calculated index.

Parameters

values – 1D array for one data point on each channel, or 2D array of shape (num_dim, num_points)

Returns

None