denselinkage.metrics.ThresholdSweep

class denselinkage.metrics.ThresholdSweep(rows: tuple[tuple[float, LinkageMetrics], ...])[source]

Bases: object

Full precision/recall/F1 curve over a threshold grid. Typed accessor, never a bare {threshold: f1} dict.

best_f1() tuple[float, LinkageMetrics][source]

The (threshold, metrics) row with the highest F1 (ties broken by the higher threshold). Raises ValueError on an empty sweep.

at_recall(target: float) tuple[float, LinkageMetrics][source]

Among rows reaching recall >= target, the highest-F1 row (ties broken by the higher threshold). Raises ValueError if no threshold reaches the target recall.