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.
stumpyParameters
Name |
Type |
Default |
Description |
|---|---|---|---|
|
int |
|
Sliding window size (use the dominant period length). |
|
int |
|
Number of segments (= change points + 1). |
|
int |
|
Multiplying factor for the exclusion zone around detected points. |
|
str |
|
Strategy for multivariate inputs ( |
|
float |
|
Tolerance for aggregating change points. |
|
int |
|
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:
BaseSegmenterFLUSS (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
- 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
fitmethod.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(seesklearn.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 tofitif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it tofit.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.
- set_predict_request(*, axis: bool | None | str = '$UNCHANGED$') FLUSSDetector
Configure whether metadata should be requested to be passed to the
predictmethod.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(seesklearn.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 topredictif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it topredict.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.