API Reference¶
Provides functions to compute the LCSS similarity measure.
- class lcsspy.lcss.LcssResult(lcss_measure: float, series_plot: Figure | None, sequence_plot: Figure | None)¶
Represents the outcome of the LCSS algorithm.
- lcss_measure¶
LCSS similarity measure. Belongs to the range [0, 1].
- Type:
float
- series_plot¶
Figure object displaying the input time series and their matched elements (with green lines).
- Type:
matplotlib.figure.Figure | None
- sequence_plot¶
Figure object displaying the elements of the input time series that are part of the longest common subsequence.
- Type:
matplotlib.figure.Figure | None
- lcsspy.lcss.continuous_lcss(ts1: Series, ts2: Series, epsilon: float, delta: Timedelta, plot: bool) LcssResult¶
Computes LCSS between time series with continuous time indexes.
Both time series can contain missing values in the form of
numpy.nan. It’s expected that each series has sorted and unique timestamps.- Parameters:
ts1 – First time series. The
indexproperty of ts1 must be of typeDatetimeIndex. Must contain either integer or float values.ts2 – Second time series. The
indexproperty of ts2 must be of typeDatetimeIndex. Must contain either integer or float values.epsilon – An upper bound to distances between time series values: elements can be matched only if their value distance is less than such threshold. Must be strictly positive.
delta – An upper bound to distances between time series indexes: elements can be matched only if their index distance is less than or equal to such threshold. The
valueproperty of delta must be positive.plot – Indicates whether the function will return plots or not.
- Returns:
A
LcssResultobject.
- lcsspy.lcss.discrete_lcss(ts1: ndarray | Series, ts2: ndarray | Series, epsilon: float, delta: int, plot: bool) LcssResult¶
Computes LCSS between time series with discrete time indexes.
Both time series can contain missing values in the form of
numpy.nan. If aSeriesobject is supplied, it will be converted to andarray, discarding itsindexin the process.- Parameters:
ts1 – First time series. Must contain either integer or float values.
ts2 – Second time series. Must contain either integer or float values.
epsilon – An upper bound to distances between time series values: elements can be matched only if their value distance is less than such threshold. Must be strictly positive.
delta – An upper bound to distances between time series indexes: elements can be matched only if their index distance is less than or equal to such threshold. Must be positive.
plot – Indicates whether the function will return plots or not.
- Returns:
A
LcssResultobject.