individual_bisegment
Per-bisegment classification analyzer for no-reset benchmarks.
- class pysatl_cpd.benchmark.online.noreset.tooling.analyzers.individual_bisegment.NoResetBisegmentAnalyzer(entries_picker=None)[source]
Bases:
NoResetAnalyzerBase,NoResetBisigementClassificationMixinAnalyzer that computes per-bisegment classification metrics at a fixed threshold.
- Parameters:
entries_picker (BenchmarkEntriesPicker | None)
- BISEGMENTS_COLUMNS: ClassVar[tuple[str, ...]] = ('bisegment_name', 'source', 'transition', 'tp', 'fp', 'fn', 'precision', 'recall', 'f1')
- analyze(benchmark_entry, threshold, *, entries_picker=None)[source]
Compute TP, FP, FN, precision, recall, and F1 per bisegment.
Picks runs matching the entry, validates them as bisegments, evaluates single-run metrics using the policies stored in the classification report, and returns a DataFrame with one row per bisegment.
- Parameters:
benchmark_entry (
OnlineNoResetBenchmarkEntry) – Entry describing detector configuration used for picking and validation.threshold (
float) – Detection threshold to apply.entries_picker (
BenchmarkEntriesPicker|None) – Override picker for selecting registry entries.
- Returns:
Table with columns: bisegment_id, original_timeseries_path, transition, change_point, tp, fp, fn, precision, recall, f1.
- Return type:
DataFrame
- static extract_error_margin_from_report(report)[source]
Extract the (left, right) error margin from a classification report.
Traverses the report’s
tpsource metric to recover theerror_margintuple used by the underlyingTruePositiveCountmetric.- Parameters:
report (
NoResetClassificationReport[Any,Any]) – Report containing thetpsource metric definition.- Returns:
The (left, right) error margin.
- Return type:
- Raises:
ValueError – If the tp metric or its error margin cannot be resolved.
- static policy_from_report_base(report_for_policy, base_name)[source]
Retrieve the no-reset policy for a source metric from the report.
- Parameters:
- Returns:
The policy object attached to the source metric.
- Return type:
- Raises:
ValueError – If the source metric or its policy is missing.
- static policy_from_report_derived(report_for_policy, derived_base_name, nested_base_name)[source]
Retrieve the no-reset policy for a derived metric from the report.
Navigates through a derived metric (e.g.
precision) to its nested source metrics to locate the policy.- Parameters:
- Returns:
The policy object attached to the nested metric.
- Return type:
- Raises:
ValueError – If the derived metric, nested source, or policy is missing.