resolver

Threshold resolution logic for no-reset benchmarks.

class pysatl_cpd.benchmark.online.noreset.thresholds.resolver.ThresholdAutoTuneConfig(*, threshold_count=100, bs_error=1e-06, t_min=0.0, t_max=1.0)[source]

Bases: object

Configuration for automatic threshold selection.

Parameters:
threshold_count: int = 100
bs_error: float = 1e-06
t_min: float = 0.0
t_max: float = 1.0
__init__(*, threshold_count=100, bs_error=1e-06, t_min=0.0, t_max=1.0)
Parameters:
Return type:

None

class pysatl_cpd.benchmark.online.noreset.thresholds.resolver.ThresholdAutoTuneResult(*, min_threshold, max_threshold, thresholds, precision, recall)[source]

Bases: object

Result of automatic threshold tuning.

Parameters:
min_threshold: float
max_threshold: float
thresholds: ndarray
precision: ndarray
recall: ndarray
__init__(*, min_threshold, max_threshold, thresholds, precision, recall)
Parameters:
Return type:

None

pysatl_cpd.benchmark.online.noreset.thresholds.resolver.auto_pick_thresholds(runs, make_recall, make_precision, *, config)[source]

Automatically select meaningful threshold bounds.

Return type:

ThresholdAutoTuneResult

Parameters:
class pysatl_cpd.benchmark.online.noreset.thresholds.resolver.NoResetThresholdResolver[source]

Bases: object

Resolves threshold grids for classification and ARL evaluation.

resolve_classification_thresholds(entry, runs, report)[source]

Resolve classification thresholds from an entry and its runs.

Uses the entry’s explicit threshold range when available, otherwise auto-tunes using the report’s precision and recall metrics.

Parameters:
Returns:

Sorted list of threshold values.

Return type:

list[float]

resolve_arl_thresholds(entry, runs, thresholds)[source]

Resolve ARL thresholds from an entry and its no-change runs.

Uses the provided thresholds when given, otherwise infers a range from the minimum and maximum detection function values across all runs.

Parameters:
Returns:

Sorted list of threshold values.

Return type:

list[float]

Raises:

ValueError – If no runs are provided or any run has an empty trace.

static infer_t_max_from_trace_values(runs)[source]

Infer an upper bound for auto-tuning from trace detection values.

Computes 101 % of the maximum detection function value across all runs. Returns a small positive epsilon if the result is non-positive.

Parameters:

runs (Sequence[SingleRun[OnlineDetectionTrace[Any], Any]]) – Runs whose detection functions are scanned for the maximum.

Returns:

Upper threshold bound for auto-tuning.

Return type:

float

Raises:

ValueError – If no runs are provided or any run has an empty trace.

__init__()
Return type:

None