Reference · The Applied Higher-Order Functions catalogue
rainbow.algorithms.proofs.ahof.kde
AHoF D12 Nonparametric Learning (Kernel Density Estimation): estimate a density as a sum of kernels centered at the data points, each with bandwidth h. What is defined here is only a closed bandwidth-WINDOW decision, true when a point's distance from the query is at most the bandwidth: in-bandwidth? distance bandwidth = decide (distance <= bandwidth). Whether a point inside the window actually contributes depends on the kernel and its support, which are not modelled here: for the triangular kernel K(u)=max(0,1-abs(u)) a point at distance equal to the bandwidth passes the window test but contributes zero. Proved native and axiom-free, as worked instances: distance 1/2 with bandwidth 3/4 is in the window, the certificate 1/2 <= 3/4, and distance 3/4 with bandwidth 1/2 is outside it. Requires audit/decide-nnrat-at-most, 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.kde` prints this classification.
kde/in-bandwidth?
kde/in-bandwidth? : (x₁ x₂ : ℚ≥0) → data/Bool
ℚ≥0 = nnrat/NonnegativeRational
kde/within-window-contributes
kde/within-window-contributes : → ce-is/elite? 1/2 3/4 = data/true
= = equality/Eq
kde/support-certificate
kde/support-certificate : → 1/2 ≤ 3/4
≤ = nnrat/at-most
kde/outside-window-excluded
kde/outside-window-excluded : → ce-is/elite? 3/4 1/2 = data/false
= = equality/Eq