tsseg.algorithms.tglad package
tGLAD — temporal Graph-difference change point detection.
Description
tGLAD segments multivariate time series by tracking the evolution of conditional independence (CI) graphs over time. A sliding window converts the series into overlapping intervals; the uGLAD sparse graph recovery model (multitask mode) recovers a precision matrix (CI graph) for each interval simultaneously. A second-order trajectory-tracking algorithm measures graph-difference scores, and an allocation algorithm produces the final segmentation.
Parameters
Name |
Type |
Default |
Description |
|---|---|---|---|
|
int |
|
Time steps per uGLAD window. |
|
int |
|
Step between successive windows. |
|
int |
|
Windows processed together by the multitask solver. |
|
float |
|
Min Frobenius distance to trigger a change point. |
|
int / None |
|
Min distance between emitted CPs (default: |
|
int |
|
uGLAD training epochs per batch. |
|
float |
|
Optimiser learning rate. |
|
int |
|
Unrolled GLAD iterations. |
|
float |
|
Eigenvalue regularisation for batch covariance. |
|
bool |
|
Print progress information. |
|
int |
|
Time axis. |
Usage
from tsseg.algorithms import TGLADDetector
detector = TGLADDetector(window_size=256, stride=64, threshold=0.4)
labels = detector.fit_predict(X)
Implementation: Origin: new code. Inspired by the tGLAD paper.
Reference: Imani & Shrivastava (2023), Are uGLAD? Time will tell!
Submodules
tsseg.algorithms.tglad.detector module
TGLAD change point detector.
- class tsseg.algorithms.tglad.detector.TGLADDetector(*, window_size=512, stride=128, batch_size=8, threshold=0.5, min_spacing=None, epochs=100, learning_rate=0.001, glad_iterations=5, eval_offset=0.1, verbose=False, axis=0)[source]
Bases:
BaseSegmenterGraph-difference based change point detector using uGLAD.
The detector follows the batching procedure described in the original tGLAD repository. The time-series is converted to overlapping windows, each window yields a precision matrix via the
uGLADmultitask solver.The change point score is calculated based on the second derivative of the sum of partial correlations derived from the precision matrices, faithfully mirroring the original implementation. Change points are emitted whenever the score exceeds
threshold.- Parameters:
window_size (
int) – Number of time steps per uGLAD window.stride (
int) – Step between successive windows.batch_size (
int) – Number of windows processed together by the multitask solver.threshold (
float) – Minimum Frobenius distance between adjacent precision matrices that triggers a change point.min_spacing (
int|None) – Minimum distance (in samples) required between two emitted change points. Defaults to the stride whenNone.epochs (
int) – Number of uGLAD training epochs per batch.learning_rate (
float) – Optimiser learning rate.glad_iterations (
int) – Number of unrolled GLAD iterations (Lin the paper).eval_offset (
float) – Eigenvalue regularisation applied to batch covariance matrices.verbose (
bool) – Forward progress flag passed through to the uGLAD routines.axis (
int) – Time axis ofX.0assumes(n_timepoints, n_features).
- set_fit_request(*, axis: bool | None | str = '$UNCHANGED$') TGLADDetector
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$') TGLADDetector
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.