tslearn.metrics.lb_envelope

tslearn.metrics.lb_envelope(ts, radius=1)[source]

Compute time-series envelope as required by LB_Keogh.

LB_Keogh was originally presented in [1].

Parameters:
ts : array-like

Time-series for which the envelope should be computed.

radius : int (default: 1)

Radius to be used for the envelope generation (the envelope at time index i will be generated based on all observations from the time series at indices comprised between i-radius and i+radius).

Returns:
array-like

Lower-side of the envelope.

array-like

Upper-side of the envelope.

See also

lb_keogh
Compute LB_Keogh similarity

References

[1]Keogh, E. Exact indexing of dynamic time warping. In International Conference on Very Large Data Bases, 2002. pp 406-417.

Examples

>>> ts1 = [1, 2, 3, 2, 1]
>>> env_low, env_up = lb_envelope(ts1, radius=1)
>>> env_low
array([[1.],
       [1.],
       [2.],
       [1.],
       [1.]])
>>> env_up
array([[2.],
       [3.],
       [3.],
       [3.],
       [2.]])

Examples using tslearn.metrics.lb_envelope