denselinkage.metrics.ClusteringMetrics

class denselinkage.metrics.ClusteringMetrics(b3_precision: float, b3_recall: float, n_clusters: int, n_gold_clusters: int)[source]

Bases: object

B³ (Bagga-Baldwin) clustering quality.

Gold clusters are the transitive closure of LabeledPairs (gold pairs -> connected components), so the same gold that scores pairwise linkage_metrics also scores clustering — one gold type everywhere. b3_precision / b3_recall are per-record B³ averages; b3_f1 is their harmonic mean. n_clusters / n_gold_clusters are reported for context. Construct via from_b3() — the two adjacent ratios are easy to transpose positionally, so the keyword constructor is the supported path (mirrors BlockingMetrics.from_pc_map).