tsseg.algorithms.amoc package
AMOC (At Most One Change) — single change point detection.
Description
AMOC searches for the single breakpoint that minimises the total sum of squared errors (SSE) on either side of the split. It is the foundational building block used internally by multi-change detectors such as Binary Segmentation and PELT, which repeatedly apply the single-change solver on sub-segments of the signal.
Parameters
Name |
Type |
Default |
Description |
|---|---|---|---|
|
int |
|
Minimum number of samples required on each side of the breakpoint. |
|
int |
|
Axis representing time in the input array. |
Usage
from tsseg.algorithms import AmocDetector
detector = AmocDetector(min_size=10)
labels = detector.fit_predict(X)
Implementation: Clean-room reimplementation of the classical SSE-based single
change point criterion. Inspired by the R changepoint package (GPL >= 2), no R
code reused. Origin: new code.
Reference: Killick, Fearnhead & Eckley (2012), JASA.
Submodules
tsseg.algorithms.amoc.detector module
AMOC detector integrated with aeon’s BaseSegmenter API.
- class tsseg.algorithms.amoc.detector.AmocDetector(*, min_size=5, axis=0)[source]
Bases:
BaseSegmenterAMOC (At Most One Change) detector.
The AMOC objective searches for the breakpoint that minimises the sum of squared errors on either side of the split. It is a foundational building block for many multi-change detectors (e.g. Binary Segmentation and PELT), which repeatedly apply the single-change solver on sub-segments of the signal.
- Parameters:
References
Examples
>>> import numpy as np >>> from tsseg.algorithms.amoc.detector import AmocDetector >>> rng = np.random.default_rng(7) >>> x = np.concatenate([ ... rng.normal(0.0, 0.2, size=200), ... rng.normal(1.0, 0.2, size=200), ... ]) >>> detector = AmocDetector(min_size=20) >>> detector.fit(x) AmocDetector(...) >>> detector.predict(x) array([...])
- set_fit_request(*, axis: bool | None | str = '$UNCHANGED$') AmocDetector
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$') AmocDetector
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.
Module contents
Aeon-compatible AMOC detector.