wildboar.transform._matrix_profile#

Module Contents#

Classes#

MatrixProfileTransform

Transform each time series in a dataset to its MatrixProfile similarity self-join

class wildboar.transform._matrix_profile.MatrixProfileTransform(window=0.1, exclude=None, n_jobs=None)[source]#

Bases: sklearn.base.TransformerMixin, wildboar.base.BaseEstimator

Transform each time series in a dataset to its MatrixProfile similarity self-join

Examples

>>> from wildboar.datasets import load_two_lead_ecg()
>>> from wildboar.transform import MatrixProfileTransform
>>> x, y = load_two_lead_ecg()
>>> t = MatrixProfileTransform()
>>> t.fit_transform(x)
Parameters:
  • window (int or float, optional) –

  • size (the exact subsequence) –

  • 0.1 (by default) –

  • float (- if) –

  • n_timestep (a fraction of) –

  • int (- if) –

  • size

  • exclude (int or float, optional) –

    The size of the exclusion zone. The default exclusion zone is 0.2

    • if float, expressed as a fraction of the windows size

    • if int, exact size (0 < exclude)

  • n_jobs (int, optional) – The number of jobs to use when computing the

fit(x, y=None)[source]#

Fit the matrix profile. Sets the expected input dimensions

Parameters:
  • x (array-like of shape (n_samples, n_timesteps) or (n_samples, n_dims, n_timesteps)) – The samples

  • y (ignored) – The optional labels.

Returns:

self

Return type:

a fitted instance

transform(x)[source]#

Transform the samples to their MatrixProfile self-join.

Parameters:

x (array-like of shape (n_samples, n_timesteps) or (n_samples, n_dims, n_timesteps)) – The samples

Returns:

mp – The matrix matrix profile of each sample

Return type:

ndarray of shape (n_samples, n_timestep) or (n_samples, n_dims, n_timesteps)