wildboar.annotate#

Package Contents#

Functions#

motifs(x[, mp, window, exclude, max_distance, ...])

Find motifs

segment([x, mpi, n_segments, window, exclude, ...])

Find change regimes in a time series.

wildboar.annotate.motifs(x, mp=None, *, window='auto', exclude=0.2, max_distance='best', max_neighbours=10, min_neighbours=1, max_motif=1, return_distance=False)[source]#

Find motifs

Parameters:
  • x (array-like of shape (n_samples, n_timestep)) – The time series

  • mp (ndarray or shape (n_samples, profile_size), optional) – The matrix profile. The matrix profile is computed if None.

  • window ("auto", int or float, optional) –

    The window size of the matrix profile.

    • if “auto” the window is math.ceil(0.1 * n_timesteps) if mp=None, and the window of the matrix profile if mp is not None.

    • if float, a fraction of n_timestep

    • if int, the exact window size

  • exclude (float, optional) – The size of the exclusion zone.

  • max_distance (str, optional) – The maximum distance between motifs.

  • max_matches (int, optional) – The maximum number of neighbours

  • min_neighbours (int, optional) – The minimum number of neighbours

  • max_motif (int, optional) – The maximum number of motifs to return.

  • return_distance (bool, optional) – Return the distance from main to neighbours

Returns:

  • motif_indicies (list) – List of arrays of motif neighbour indicies

  • motif_distance (list, optional) – List of arrays of distance from motif to neighbours

See also

wildboar.distance.subsequence_match

find subsequence matches

wildboar.distance.matrix_profile

compute the matrix profile

References

Yeh, C. C. M. et al. (2016).

Matrix profile I: All pairs similarity joins for time series: a unifying view that includes motifs, discords and shapelets. In 2016 IEEE 16th international conference on data mining (ICDM)

wildboar.annotate.segment(x=None, *, mpi=None, n_segments=1, window=0.1, exclude=0.2, boundry=1.0, return_arc_curve=False)[source]#

Find change regimes in a time series.

Parameters:
  • x (array-like of shape (n_samples, n_timestep) or (n_timestep, ), optional) – The time series. If x is given, the matrix profile of x is computed.

  • mpi (array-like of shape (n_samples, profile_size) or (profile_size), optional) – The matrix profile index. Must be given unless x is given.

  • n_segments (int, optional) – The number of segmentations to identify

  • window (int or float, optional) –

    The window size. The window parameter is ignored if mpi is not None.

    • if float, a fraction of n_timestep

    • if int, the exact window size

  • exclude (float, optional) – The self-join exclusion for the matrix profile. Ignored if mpi is given.

  • boundry (float, optional) – The region around an identified segmentation that is ignored when searching for subsequent segmentations

  • return_arc_curve (bool, optional) – Return the arc curve.

Returns:

  • segments (ndarray of shape (n_samples, n_segments), (n_segments) or int) – The start index of a segment

  • arc_curves (ndarray of shape (n_samples, profile_size) or (profile_size, )) – The arc curves

See also

wildboar.distance.matrix_profile

compute the matrix profile

References

Gharghabi, Shaghayegh, et al. (2017)

Matrix profile VIII: domain agnostic online semantic segmentation at superhuman performance levels. In proceedings of International Conference on Data Mining