denselinkage.metrics.tune_threshold¶
- denselinkage.metrics.tune_threshold(candidates: Sequence[CandidatePair], *, gold: LabeledPairs, thresholds: Sequence[float] | None = None, directed: bool = True) ThresholdSweep[source]¶
Sweep a similarity threshold over scored
candidatesand return the full precision/recall/F1 curve as aThresholdSweep.Each candidate is classified a match iff
similarity_score >= t(inclusive, matchingThresholdMatcher). A candidate withsimilarity_score is Noneis undecidable and counts as an error at every threshold — excluded from false negatives and surfaced asn_errors— the same accountinglinkage_metricsuses.directedfollowslinkage_metrics(passdirected=Falsefordedupecandidates).thresholdsdefaults to the sorted distinct candidate scores — the only cut points that change the prediction, so the curve is exact andThresholdSweep.best_f1finds the true optimum; pass an explicit grid to override. An empty candidate set (or empty grid) yields an empty sweep.