Commit e99e33d
fix(kernels): correct q=2 coefficient in PiecewisePolynomialKernel (#2756)
The q=2 branch of _get_cov used (j + 4*j + 3) instead of (j**2 + 4*j + 3),
yielding 5j+3 in place of j^2+4j+3 and producing materially wrong covariance
values for the default smoothness setting. Fix the coefficient to match
Rasmussen & Williams Eq. 4.21 (and the kernel's own docstring and test
reference). Add a q=2 numeric test with closely-spaced inputs so the
polynomial term is actually exercised (existing tests only used q=0 with
out-of-support distances, masking the bug).
Co-authored-by: Geoff Pleiss <gpleiss@gmail.com>1 parent 93222a0 commit e99e33d
2 files changed
Lines changed: 24 additions & 1 deletion
File tree
- gpytorch/kernels
- test/kernels
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
67 | 90 | | |
68 | 91 | | |
69 | 92 | | |
| |||
0 commit comments