wildboar.annotate#

Annotation of time series.

See the annotation section in the User Guide for more details and examples.

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='auto', max_neighbours=10, min_neighbours=1, max_motif=1, return_distance=False)[source]#

Find motifs.

Parameters:
xarray-like of shape (n_samples, n_timestep)

The time series

mpndarray 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

excludefloat, optional

The size of the exclusion zone.

max_distancestr, optional

The maximum distance between motifs.

max_neighboursint, optional

The maximum number of neighbours

min_neighboursint, optional

The minimum number of neighbours

max_motifint, optional

The maximum number of motifs to return.

return_distancebool, optional

Return the distance from main to neighbours

Returns:
motif_indicieslist

List of arrays of motif neighbour indicies

motif_distancelist, 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:
xarray-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.

mpiarray-like of shape (n_samples, profile_size) or (profile_size), optional

The matrix profile index. Must be given unless x is given.

n_segmentsint, optional

The number of segmentations to identify

windowint 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

excludefloat, optional

The self-join exclusion for the matrix profile. Ignored if mpi is given.

boundryfloat, optional

Ignore the region around each identified segmentation. Expressed as a fraction of window.

return_arc_curvebool, optional

Return the arc curve.

Returns:
segmentsndarray of shape (n_samples, n_segments), (n_segments) or int

The start index of a segment

arc_curvesndarray 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