run_lengths
Module for computing Run Lengths between consecutive alarms (detections) for online algorithms.
In this implementation run length is simply the distance (in time steps) between consecutive detected change points (‘positives’). The first run length is measured from time step 0 to the first detection.
Note
Ground truth (data) is not used here. Metrics that require TP/FP separation should be implemented separately (e.g., via classification metrics).
- class pysatl_cpd.analysis.metrics.single_run.online.run_lengths.RunLengths[source]
Bases:
ISingleRunMetric[TraceT,ProviderT,list[int]],GenericComputes run lengths between consecutive detections.
Run length is the distance between two successive detected change points, starting from time 0. This is the definition used for Average Run Length (ARL) - every detection is treated as a positive, ground-truth is ignored.
- evaluate(run)[source]
Calculate run lengths between consecutive detections.
- Parameters:
run (
SingleRun[TypeVar(TraceT, bound=OnlineDetectionTrace),TypeVar(ProviderT, bound=LabeledData)]) – The run to evaluate. Only run.trace is used.- Returns:
Distances between consecutive detections, with the first distance measured from 0 to the first detection.
- Return type: