Skip to content
Rainbow docs menu

Reference · The Applied Higher-Order Functions catalogue

rainbow.algorithms.proofs.ahof.precision-recall

The Applied Higher-Order Functions cataloguesrc/rainbow/algorithms/proofs/ahof/precision_recall.clj2 definitions, 3 theorems

AHoF Precision and Recall: the two complementary quality metrics of a binary classifier, computed from the confusion-matrix counts (true/false positives and negatives), precision tp fp = tp / (tp + fp) (of predicted positives, how many are right) recall tp fn = tp / (tp + fn) (of actual positives, how many are found). Precision penalizes false alarms; recall penalizes misses; the trade-off between them (tuned by the decision threshold) is the basis of the precision-recall curve and F1. Proved native and axiom-free: precision and recall as exact rational divisions of the true-positive count by predicted-positives and actual-positives respectively; worked values; and that a classifier with no false positives has precision 1. The confusion-matrix tallies are executable; what is proved is the precision/recall fractions. Requires nnrat/add, nnrat/divide (division is the rational-division capability, composed here), nnrat/equivalent, and the D63 checkpoint. Scope (measured by the kernel): this module has 3 worked instances (statements about specific values). None of its theorems is a guarantee about the algorithm for all inputs; `lein verify rainbow.algorithms.proofs.ahof.precision-recall` prints this classification.

Depends onmath.rational.division

precision-recall/precision

DefinitionSource, line 65

precision-recall/precision :
  (x₁ x₂ : ℚ≥0)
  → ℚ≥0

ℚ≥0 = nnrat/NonnegativeRational

precision-recall/recall

DefinitionSource, line 72

precision-recall/recall :
  (x₁ x₂ : ℚ≥0)
  → ℚ≥0

ℚ≥0 = nnrat/NonnegativeRational

precision-recall/precision-example

TheoremWorked exampleNo axiomsSource, line 83

precision-recall/precision-example :
  → kalman/gain 3 1 = 3/4

= = nnrat/equivalent: equality of rational values

precision-recall/recall-example

TheoremWorked exampleNo axiomsSource, line 89

precision-recall/recall-example :
  → kalman/gain 3 2 = 3/5

= = nnrat/equivalent: equality of rational values

precision-recall/no-false-positives-precision-one

TheoremWorked exampleNo axiomsSource, line 95

precision-recall/no-false-positives-precision-one :
  → kalman/gain 5 0 = 1

= = nnrat/equivalent: equality of rational values