Commit f01f0f9
Add SoftKNNClassifierModel (facebook#5072)
Summary:
X-link: meta-pytorch/botorch#3243
Add a differentiable Soft K-Nearest Neighbors classifier model for failure-aware
Bayesian optimization. Unlike tree-based classifiers (RF, XGBoost), SoftKNN is
fully differentiable, enabling gradient-based acquisition function optimization.
The model uses Gaussian kernel weights:
P(y=1|x) = sum(w_i * y_i) / sum(w_i)
where w_i = exp(-||x - x_i||^2 / (2 * sigma^2))
Implements construct_inputs classmethod for seamless Ax integration.
Differential Revision: D908943891 parent 358c4c6 commit f01f0f9
2 files changed
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| |||
808 | 809 | | |
809 | 810 | | |
810 | 811 | | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
811 | 821 | | |
812 | 822 | | |
813 | 823 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
| |||
145 | 146 | | |
146 | 147 | | |
147 | 148 | | |
| 149 | + | |
| 150 | + | |
148 | 151 | | |
149 | 152 | | |
150 | 153 | | |
| |||
0 commit comments