delays
Module for computing the detection delay in online change point detection.
Evaluates how quickly an online algorithm reacts to a true change point. Missed change points are penalized with the maximum allowable delay.
- class pysatl_cpd.analysis.metrics.single_run.online.delays.Delays(max_delay)[source]
Bases:
ISingleRunMetric[TraceT,ProviderT,list[int]],GenericComputes the detection delay for online change point detection algorithms.
Delay is defined as the distance between an actual change point and its corresponding detection. If a change point is missed (False Negative), the algorithm is penalized with the maximum defined delay.
- Parameters:
max_delay (
int) – The maximum allowable delay window for a valid detection. Also used as the penalty value for missed detections (FN).- Raises:
ValueError – If maximum delay is negative
- evaluate(run)[source]
Calculate delays for all true change points
Delay is computed per true change point as the minimum non-negative delay among matched detections within [true_change, true_change + max_delay]. If there is no match, max_delay is returned for that change point.
- Parameters:
run (
SingleRun[TypeVar(TraceT, bound=OnlineDetectionTrace),TypeVar(ProviderT, bound=LabeledData)]) – The run to evaluate.- Returns:
A list of delays where each element corresponds to the true change point at the same index in
data.change_points. Length is exactly equal to the number of true change points.- Return type: