-
Notifications
You must be signed in to change notification settings - Fork 36
Add kappa
to stationary Gabor kernel
#79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Could you just change the |
@willtebbutt @theogf @devmotion Is it ready to merge? |
src/basekernels/gabor.jl
Outdated
|
||
kappa(κ::GaborKernel, x, y) = kappa(κ.kernel, x, y) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need this? Can't we just use the generic implementation in
KernelFunctions.jl/src/generic.jl
Line 7 in 89baf9c
kappa(κ::Kernel, x, y) = kappa(κ, evaluate(metric(κ), x, y)) |
kappa(κ::GaborKernel, x, y) = kappa(κ.kernel, x, y) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering why without this the test kappa(k, x, y) == kappa(k, evaluate(KernelFunctions.metric(k), x, y))
was failing without this line. There was an error in the kappa(::GaborKernel, d::Real)
.
Apparently, kappa(k::TransformedKernel, d) = kappa(k.kernel, d)
, so it doesn't do the transformation before applying the kernel using the distance measure. I think this is a bug?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Present fix is to modify the kappa to give the intended output of gabor kernel
function kappa(κ::GaborKernel, d::Real)
return kappa(κ.kernel.kernels[1], (d/κ.ell)^2) * kappa(κ.kernel.kernels[2], d/κ.p)
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not something we want to do since ell
and p
do not have to be scalar valued. It seems it just doesn't make sense to define kappa(::GaborKernel, ::Real)
and metric(::GaborKernel)
, and we should just keep the old implementation of forwarding kappa
to the underlying kernel? If we want to do any optimization based on the metric, it should be done in KernelProd
(see the PR for its refactoring).
Unfortunately, IMO this PR should be closed since it is not guaranteed that parameters |
To be honest, I'm a bit confused as to why we have this implemented as a kernel at all. It seems like something that would be best implemented by a helper function in terms of |
I agree, I'm still not fully convinced that we should have a separate type. We had a discussion about this when it was added (see #52 (comment) and the comments below). IIRC one argument for having a dedicated type was that otherwise the parameters of the Gabor kernel can't be accessed easily. |
Yes accessing the Gabor's parameters was the only issue if it were just a simple function returning a |
I don't think this PR has any value anymore. Gabor kernel is a |
I guess we should close this PR because kappa only make sense for |
Since Gabor kernel is a Stationary and and Isotropic kernel, I thought it would be a good idea to add
kappa
of the formkappa(κ::GaborKernel, d::Real)
. Missed it earlier in #52 .