JuliaGaussianProcesses / KernelFunctions.jl

Julia package for kernel functions for machine learning
https://juliagaussianprocesses.github.io/KernelFunctions.jl/stable/
MIT License
266 stars 32 forks source link

Fix Gabor the bad boy #284

Open theogf opened 3 years ago

theogf commented 3 years ago

The Gabor kernel constantly but randomly fails the CI tests. We should investigate if we can make a more stable implementation or something similar.

theogf commented 3 years ago

I might be wrong is the implementation compleletely wrong? Or at least inconsistent with the math definition? The math definition we have is : image

But we implement it as a product of a CosineKernel and a SqExponentialKernel : https://github.com/JuliaGaussianProcesses/KernelFunctions.jl/blob/70e3593aa47ce6004f6be0e8bc1b4768f91e6fc5/src/basekernels/gabor.jl#L21

From the definition in https://arxiv.org/abs/1302.4245 it looks like the math definition is wrong and it is essentially a special case of the spectral mixture kernel. I think it would make sense to get rid of it since the spectral mixture implementation would probably not be that much slower than Gabor.

devmotion commented 3 years ago

I noticed this a while ago: https://github.com/JuliaGaussianProcesses/KernelFunctions.jl/pull/240

devmotion commented 3 years ago

In the latest release, https://github.com/JuliaGaussianProcesses/KernelFunctions.jl/issues/284#issuecomment-833445916 is addressed (formula is correct and GaborKernel is deprecated in favour of gaborkernel). It is unclear though if these fixes all test issues. At least so far all AD tests pass for gaborkernel (for GaborKernel only Zygote is enabled).