tsseg.algorithms.patss package
PaTSS — Pattern-based Time Series Segmentation.
Description
PaTSS detects states in time series by mining frequent temporal patterns, building a pattern-based embedding matrix, and clustering the resulting features. The pipeline consists of three stages:
Pattern mining — extracts frequent sub-patterns from the series using configurable length, frequency and overlap parameters.
Embedding — constructs a binary or frequency-based embedding matrix where each row is a time step and each column a mined pattern.
Segmentation — applies a segmentation algorithm (default: logistic regression classifier) on the embedding to partition the series into states.
All configuration is passed through a config dictionary.
Parameters
Name |
Type |
Default |
Description |
|---|---|---|---|
|
dict / None |
|
Settings for PaTSS. If |
|
int |
|
Time axis (input assumed |
Usage
from tsseg.algorithms import PatssDetector
detector = PatssDetector() # default config
states = detector.fit_predict(X)
# Custom config
detector = PatssDetector(config={"pattern_length": 20, "n_segments": 5})
states = detector.fit_predict(X)
Implementation: Adapted from the original PaTSS code.
Reference: —
Subpackages
- tsseg.algorithms.patss.algorithms package
- tsseg.algorithms.patss.embedding package
- Submodules
- tsseg.algorithms.patss.embedding.FrequentPatternMiningEmbedder module
- tsseg.algorithms.patss.embedding.PatternBasedEmbedder module
- tsseg.algorithms.patss.embedding.PatternBasedEmbedding module
- tsseg.algorithms.patss.embedding.embedding_matrix module
- tsseg.algorithms.patss.embedding.pattern_filter module
- tsseg.algorithms.patss.embedding.pattern_mining module
- Module contents
- tsseg.algorithms.patss.segmentation package
Submodules
tsseg.algorithms.patss.detector module
This module provides a wrapper for the PaTSS algorithm to integrate it with the tsseg library’s API, following the aeon BaseSegmenter structure.
- class tsseg.algorithms.patss.detector.PatssDetector(config=None, axis=0)[source]
Bases:
BaseSegmenterA wrapper for the PaTSS (Pattern-based Time Series Segmentation) algorithm, compatible with the aeon framework.
This implementation uses the original logic from PaTSS_perso.py and adapts it to the BaseSegmenter API.
- Parameters:
- set_fit_request(*, axis: bool | None | str = '$UNCHANGED$') PatssDetector
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$') PatssDetector
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.