Reference · The Applied Higher-Order Functions catalogue
rainbow.algorithms.proofs.ahof.svm
AHoF Support Vector Machine (linear, hard-margin classification): find the hyperplane that separates two classes with the MAXIMUM margin, then classify a point by which side it falls on. Training maximizes the margin subject to every example satisfying y_i (w.x_i - b) >= 1; at prediction time, a point is assigned the positive class when its functional margin reaches the decision boundary: classify-positive? margin threshold = decide (threshold <= margin) where margin = w.x - b and threshold = 0 for the decision, or 1 for the confident-margin band, over exact-rational margins. Proved native and axiom-free: the side-of-hyperplane decision; that a point on the positive side is classified positive; the certificate that a point classified confident-positive really has functional margin at least 1 (native nnrat/at-most) -- the max-margin constraint; and that a point below the boundary is classified negative. The weight vector, bias, and dot product are executable; what is proved is the margin decision. Requires nnrat/at-most, audit/decide-nnrat-at-most, nnrat/decide-at-most-true-sound (all in 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.svm` prints this classification.
svm/classify-positive?
svm/classify-positive? : (x₁ x₂ : ℚ≥0) → data/Bool
ℚ≥0 = nnrat/NonnegativeRational
svm/positive-side-classified-positive
svm/positive-side-classified-positive : → bo/is-safe 2 0 = data/true
= = equality/Eq
svm/confident-margin-at-least-one
svm/confident-margin-at-least-one : → 1 ≤ 2
≤ = nnrat/at-most
svm/inside-margin-not-confident
svm/inside-margin-not-confident : → bo/is-safe 0 1 = data/false
= = equality/Eq