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, NoResetBisigementClassificationMixin

Analyzer 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:
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 tp source metric to recover the error_margin tuple used by the underlying TruePositiveCount metric.

Parameters:

report (NoResetClassificationReport[Any, Any]) – Report containing the tp source metric definition.

Returns:

The (left, right) error margin.

Return type:

tuple[int, int]

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:
  • report_for_policy (Any) – Classification report (duck-typed) containing source metrics.

  • base_name (str) – Key identifying the source metric (e.g. 'tp', 'fp').

Returns:

The policy object attached to the source metric.

Return type:

Any

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:
  • report_for_policy (Any) – Classification report (duck-typed) containing derived metrics.

  • derived_base_name (str) – Key identifying the derived metric (e.g. 'precision').

  • nested_base_name (str) – Key identifying the nested source metric (e.g. 'tp').

Returns:

The policy object attached to the nested metric.

Return type:

Any

Raises:

ValueError – If the derived metric, nested source, or policy is missing.