tsseg.algorithms.fluss package

FLUSS — Fast Low-cost Unipotent Semantic Segmentation.

Description

FLUSS is a domain-agnostic method for semantic segmentation of time series. It leverages the matrix profile (computed by stumpy) and derives the arc curve: for each time index the number of nearest-neighbour arcs crossing that index is counted. Valleys in the arc curve indicate semantic boundaries because few matching subsequences span across a true regime change.

A sequential peak search on the inverted arc curve yields the requested number of change points. FLUSS has only one parameter — the window size — which corresponds to the dominant period length.

Type: change point detection
Supervision: semi-supervised or unsupervised
Scope: univariate (multivariate via ensembling)
Requires: stumpy

Parameters

Name

Type

Default

Description

window_size

int

10

Sliding window size (use the dominant period length).

n_segments

int

2

Number of segments (= change points + 1).

exclusion_factor

int

5

Multiplying factor for the exclusion zone around detected points.

multivariate_strategy

str

"ensembling"

Strategy for multivariate inputs ("ensembling").

tolerance

float

0.01

Tolerance for aggregating change points.

axis

int

0

Time axis.

Usage

from tsseg.algorithms import FLUSSDetector

detector = FLUSSDetector(window_size=50, n_segments=4)
labels = detector.fit_predict(X)

Implementation: Wrapper around stumpy. BSD 3-Clause.

Reference: Gharghabi, Yeh, Ding, Ding, Hibbing, LaMunion, Kaplan, Crouter & Keogh (2017, 2019), Domain Agnostic Online Semantic Segmentation, ICDM / DMKD.

Submodules

tsseg.algorithms.fluss.detector module

FLUSS (Fast Low-cost Unipotent Semantic Segmentation) Segmenter.

class tsseg.algorithms.fluss.detector.FLUSSDetector(window_size=10, n_segments=2, exclusion_factor=5, axis=0, multivariate_strategy='ensembling', tolerance=0.01)[source]

Bases: BaseSegmenter

FLUSS (Fast Low-cost Unipotent Semantic Segmentation) Segmenter.

FLOSS [1] FLUSS is a domain-agnostic online semantic segmentation method that operates on the assumption that a low number of arcs crossing a given index point indicates a high probability of a semantic change. Segments are called regimes in the original paper and stumpy package, but here we use the term segments to be consistent with state detection terminology.

Parameters:
  • window_size (int, default = 10) – Size of window for sliding, based on the period length of the data.

  • n_segments (int, default = 2) – The number of segments to search (equal to change points - 1).

  • exclusion_factor (int, default 5) – The multiplying factor for the segment exclusion zone

  • multivariate_strategy (str, default="ensembling") – Strategy for handling multivariate data: “ensembling” or “l2”.

  • tolerance (int, default=0) – Tolerance for aggregating change points in ensembling strategy.

References

Examples

>>> from aeon.segmentation import FLUSSSegmenter
>>> from aeon.datasets import load_gun_point_segmentation
>>> X, true_period_size, cps = load_gun_point_segmentation()
>>> fluss = FLUSSSegmenter(window_size=10, n_segments=2)
>>> found_cps = fluss.fit_predict(X)
>>> profiles = fluss.profiles
>>> scores = fluss.scores
get_fitted_params()[source]

Get fitted parameters.

Returns:

fitted_params

Return type:

dict

predict_scores(X)[source]

Return scores in FLUSS’s profile for each annotation.

Parameters:

np.ndarray – 1D time series to be segmented.

Returns:

Scores for sequence X

Return type:

np.ndarray

set_fit_request(*, axis: bool | None | str = '$UNCHANGED$') FLUSSDetector

Configure whether metadata should be requested to be passed to the fit method.

Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with enable_metadata_routing=True (see sklearn.set_config()). Please check the User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to fit if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to fit.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Parameters:

axis (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for axis parameter in fit.

Returns:

self – The updated object.

Return type:

object

set_predict_request(*, axis: bool | None | str = '$UNCHANGED$') FLUSSDetector

Configure whether metadata should be requested to be passed to the predict method.

Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with enable_metadata_routing=True (see sklearn.set_config()). Please check the User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to predict if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to predict.

  • None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.

  • str: metadata should be passed to the meta-estimator with this given alias instead of the original name.

The default (sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.

Added in version 1.3.

Parameters:

axis (str, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED) – Metadata routing for axis parameter in predict.

Returns:

self – The updated object.

Return type:

object

Module contents