base

Base classes for single-run classification metrics.

class pysatl_cpd.analysis.metrics.single_run.classification.base.ClassificationMetricBase(error_margin)[source]

Bases: ISingleRunMetric, Generic

Base class for single-run metrics built on change-point matching.

Parameters:

error_margin (tuple[int, int]) – Allowed (left, right) margin for matching detections to true CPs.

__init__(error_margin)[source]
Parameters:

error_margin (tuple[int, int])

Return type:

None

match(detected_change_points, true_change_points)[source]

Match detections to true change points using stored margin.

Parameters:
  • detected_change_points (Sequence[int]) – Detected change-point indices.

  • true_change_points (Sequence[int]) – Ground-truth change-point indices.

Return type:

dict[int, set[int]]

abstractmethod evaluate(run)[source]

Evaluate the metric for a single run.

Parameters:

run (SingleRun[TypeVar(TraceT, bound= DetectionTrace), TypeVar(ProviderT, bound= LabeledData)]) – The run to evaluate.

Return type:

TypeVar(ResultT)

class pysatl_cpd.analysis.metrics.single_run.classification.base.ClassificationPrimitive(error_margin)[source]

Bases: ClassificationMetricBase[TraceT, ProviderT, int], Generic

Base class for count-based single-run classification metrics.

Parameters:

error_margin (tuple[int, int])

abstractmethod evaluate(run)[source]

Evaluate the metric for a single run.

Parameters:

run (SingleRun[TypeVar(TraceT, bound= DetectionTrace), TypeVar(ProviderT, bound= LabeledData)]) – The run to evaluate.

Return type:

int