Periodic kernel for multivariate input
See original GitHub issue🐛 Bug
Implementation of PeriodicKernel is not positive definite in case of multivariate input Here is how I checked it:
** Code snippet to reproduce **
import torch
from gpytorch import kernels
X = torch.randn(1000, 2, dtype=torch.float64)
kernel = kernels.PeriodicKernel().double()
with torch.no_grad():
K = kernel(X, X).evaluate()
eig = torch.symeig(K)[0]
negative_eig = eig[eig < 0]
assert torch.allclose(negative_eig, torch.zeros_like(negative_eig))
** Stack trace/error message **
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<ipython-input-2-1d738d7c73d9> in <module>
9
10 negative_eig = eig[eig < 0]
---> 11 assert torch.allclose(negative_eig, torch.zeros_like(negative_eig))
AssertionError:
Expected Behavior
Positive definite kernel must have non-negative eigenvalues.
The implementation is correct for one-dimensional input. For multidimensional input it should be product of one-dimensional kernels, however, it calculates the norm first and applies sine and exponent to the norm which is not correct: see eq. (47) on page 15 of
MacKay, D. J. (1998). Introduction to Gaussian processes. NATO ASI Series F Computer and Systems Sciences, 168, 133-166.
System information
Please complete the following information:
- gpytorch=0.3.4
- torch=1.1.0
- Ubuntu 19.04
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Analytic Long Term Forecasting with Periodic Gaussian ...
The Gaussian process models can account for the periodicity by using a periodic kernel. Long term predictions need to deal with uncertain points,...
Read more >Gaussian processes (3/3) - exploring kernels
The local periodic kernel is a multiplication of the periodic kernel with the exponentiated quadratic kernel to allow the periods to vary over...
Read more >21 : Advanced Gaussian Processes
kernel function is valid for a GP. A stationary kernel function is invariant under translations of the input space, i.e. it is a...
Read more >Gaussian process kernels - Towards Data Science
Perhaps the most widely used kernel is probably the radial basis function kernel (also called the quadratic exponential kernel, the squared exponential kernel ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The periodic kernel is by definition a kernel defined in 1D. To extend to multiple dimensions use e.g. ProductKernel
@tawe141 I don’t think we ever got around to this. If you’re interested and willing, we’d love a PR from you!