detection_trace

Module contains detection trace container for changepoint detection results.

This module provides a unified container for storing detection results from both online and offline changepoint detection algorithms.

class pysatl_cpd.core.detection_trace.DetectionTrace(*, detected_change_points=<factory>, detector_description)[source]

Bases: object

Container for changepoint detection algorithm output.

This class stores the detected changepoint positions It serves as a unified result type for both online and offline detection algorithms.

Variables:
  • detected_change_points – Indices where changepoints were detected. For online algorithms, these are typically reported as they occur. For offline algorithms, these are the final changepoint positions.

  • detector_description – Description of the detector that produced the trace.

Parameters:

Examples

>>> trace = DetectionTrace(detected_change_points=[2, 4])
>>> trace.detected_changes
[2, 4]
detected_change_points: Sequence[int]
detector_description: ChangePointDetectorDescription
__hash__()[source]

Return a stable hash for the trace contents and detector identity.

Return type:

int

__post_init__()[source]

Validate detection trace consistency.

Ensures that: - Detected change-point indices are valid (non-negative) - All indices are unique

Raises:

ValueError – If any detected change index is negative, or if indices are not unique.

Return type:

None

__init__(*, detected_change_points=<factory>, detector_description)
Parameters:
Return type:

None