InformationGain (IGTS)#
IGTS – Information Gain based Temporal Segmentation.
Description#
IGTS is a top-down greedy algorithm that locates the change point maximising the information gain at each step, then repeats on the resulting sub-signals. It works best on multivariate series where distribution shifts across channels provide discriminative evidence.
Warning
IGTS does not perform well on univariate series without augmentation.
k_max and s
is step: each of the K greedy steps scores the \(n/s\) candidate
locations from cumulative sums, over at most \(K + 1\) segmentsParameters#
Name |
Type |
Default |
Description |
|---|---|---|---|
|
int |
|
Maximum number of change points. Fewer are returned when every
candidate location (the multiples of |
|
int |
|
Stride for candidate locations. |
|
int |
|
Time axis (rows with |
Usage#
from tsseg.algorithms import InformationGainDetector
detector = InformationGainDetector(k_max=8, step=5)
change_points = detector.fit_predict(X)
Implementation: Adapted from aeon. BSD 3-Clause.
Reference: Sadri, Ren & Salim (2017), Information Gain-based Metric for Recognizing Transitions in Human Activities, Pervasive and Mobile Computing.
API reference#
Information Gain-based Temporal Segmenter.
Information Gain Temporal Segmentation (_IGTS) is a method for segmenting multivariate time series based off reducing the entropy in each segment.
The amount of entropy lost by the segmentations made is called the Information Gain (IG). The aim is to find the segmentations that have the maximum information gain for any number of segmentations.
- class InformationGainDetector(*, k_max=10, step=5, axis=0)[source]#
Bases:
BaseSegmenterInformation Gain based Temporal Segmentation (IGTS) Estimator.
IGTS is an unsupervised method for segmenting time series into non-overlapping segments by locating change points that maximise the information gain.
Information gain (IG) is defined as the amount of entropy lost by the segmentation. The aim is to find the segmentation that has the maximum information gain for a specified number of segments.
IGTS uses a top-down search to greedily find the next change point that creates the maximum information gain. Once found, the process repeats until
k_maxsplits have been made, or until every candidate position (the multiples ofstep) is already a change point, in which case fewer thank_maxchange points are returned.For univariate input the series is automatically augmented with its normalised complement channel (Eq. 12-13 of [1]) so that entropy can vary across segments.
- Parameters:
k_max (
int) – Maximum number of change points to find, hence at mostk_max + 1segments.0returns no change point.step (
int) – Step size, or stride for selecting candidate locations of change points. For example astep=5would produce candidates [0, 5, 10, …]. Has the same meaning asstepinrangefunction.axis (
int) – Time axis: rows with0, columns with1.
- intermediate_results_#
One entry per change point added, in the order of the search:
k(0 for the first change point), the information gainscoreand thechange_pointsfound so far, with the boundaries 0 andn.- Type:
list of
ChangePointResult
Notes
Based on the work from [1]. - alt. py implementation: cruiseresearchgroup/IGTS-python - MATLAB version: cruiseresearchgroup/IGTS-matlab
References
Examples
>>> import numpy as np >>> from tsseg.algorithms import InformationGainDetector >>> rng = np.random.default_rng(0) >>> X = np.concatenate([rng.normal(0, 1, (100, 2)), rng.normal(5, 1, (100, 2))]) >>> X = np.concatenate([X, rng.normal(0, 1, (100, 2)) + [5, -5]]) >>> igts = InformationGainDetector(k_max=2, step=5) >>> igts.fit_predict(X) array([100, 200])
- set_fit_request(*, axis='$UNCHANGED$')#
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='$UNCHANGED$')#
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.