generalized_cusum
Generalized CUSUM source implementation.
This module provides GeneralizedCUSUM, a configurable online detector
that combines three components:
an estimating schema,
a monitoring schema,
and a change-point function (CPF).
Concrete CUSUM algorithms configure these components via factory functions.
- class pysatl_cpd.algorithms.online.cusum.abstracts.generalized_cusum.GeneralizedCUSUMConfiguration(*, learning_period_size=0, adaptive_estimation=True)[source]
Bases:
OnlineAlgorithmConfigurationConfiguration for Generalized CUSUM algorithms.
- class pysatl_cpd.algorithms.online.cusum.abstracts.generalized_cusum.GeneralizedCUSUMState(*, is_in_learning_period=False, statistics)[source]
Bases:
OnlineAlgorithmState,GenericState for Generalized CUSUM algorithms.
- Parameters:
is_in_learning_period (bool)
statistics (ISchemaEstimates)
- statistics: ISchemaEstimates
- __init__(*, is_in_learning_period=False, statistics)
- Parameters:
is_in_learning_period (bool)
statistics (ISchemaEstimates)
- Return type:
None
- class pysatl_cpd.algorithms.online.cusum.abstracts.generalized_cusum.GeneralizedCUSUM(configuration, estimating_schema, monitoring_schema, changepoint_func, adaptive_estimation=True)[source]
Bases:
OnlineAlgorithm,GenericBase class for configurable online CUSUM detectors.
- Parameters:
configuration (
TypeVar(ConfigurationT, bound=GeneralizedCUSUMConfiguration)) – Algorithm configuration instance.estimating_schema (
IEstimatingSchema[TypeVar(DataT),TypeVar(EstimatesT, bound=ISchemaEstimates)]) – Schema that estimates model parameters from data.monitoring_schema (
IMonitoringSchema[TypeVar(DataT),TypeVar(EstimatesT, bound=ISchemaEstimates),TypeVar(MonitoringT)]) – Schema that transforms observations into monitoring-space residuals.changepoint_func (
ICusumChangepointFunc[TypeVar(MonitoringT)]) – CUSUM change-point function applied to monitoring residuals.adaptive_estimation (
bool) – Whether to update estimates online after training.
- __init__(configuration, estimating_schema, monitoring_schema, changepoint_func, adaptive_estimation=True)[source]
- Parameters:
configuration (ConfigurationT)
estimating_schema (IEstimatingSchema)
monitoring_schema (IMonitoringSchema)
changepoint_func (ICusumChangepointFunc)
adaptive_estimation (bool)
- Return type:
None
- abstract property configuration: ConfigurationT
Configuration parameters of the algorithm.
- Returns:
Immutable configuration object containing algorithm settings.
- Return type:
ConfigurationT- Raises:
NotImplementedError – Subclasses must implement this property.
- abstract property state: StateT
Current internal state snapshot of the algorithm.
- Returns:
Immutable state snapshot of the algorithm.
- Return type:
StateT- Raises:
NotImplementedError – Subclasses must implement this property.
- residual(argument)[source]
Transform a raw observation into monitoring-space residual.
Delegates to the monitoring schema.
- property estimating_schema: IEstimatingSchema
Estimating schema instance.
- Return type:
IEstimatingSchema[DataT,EstimatesT]
- property monitoring_schema: IMonitoringSchema
Monitoring schema instance.
- Return type:
IMonitoringSchema[DataT,EstimatesT,MonitoringT]
- property changepoint_func: ICusumChangepointFunc
CUSUM change-point function instance.
- Return type:
ICusumChangepointFunc[MonitoringT]
- property estimates: EstimatesT
Current model parameter estimates from the estimating schema.
- Return type:
EstimatesT
- process(observation)[source]
Ingest one observation and return the change-point statistic.
During training (learning_period_size steps) accumulates samples and returns 0. After training, updates the CUSUM change-point function and optionally the estimating schema (adaptive mode).