-
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
Changes from 4 commits
7bf3e68
6276381
b9cb30a
42ce46f
2560647
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -3,7 +3,7 @@ | |||||||
|
||||||||
Gabor kernel with length scale ell and period p. Given by | ||||||||
```math | ||||||||
κ(x,y) = h(x-z), h(t) = exp(-sum(t.^2./(ell.^2)))*cos(pi*sum(t./p)) | ||||||||
κ(x,y) = h(x-z), h(t) = exp(-sum(t.^2./(ell.^2)))*cos(pi*sum(t./p)) | ||||||||
``` | ||||||||
|
||||||||
""" | ||||||||
|
@@ -51,9 +51,13 @@ function Base.getproperty(k::GaborKernel, v::Symbol) | |||||||
end | ||||||||
end | ||||||||
|
||||||||
Base.show(io::IO, κ::GaborKernel) = print(io, "Gabor Kernel (ell = ", κ.ell, ", p = ", κ.p, ")") | ||||||||
function kappa(κ::GaborKernel, d::Real) | ||||||||
return kappa(κ.kernel.kernels[1], d^2) * kappa(κ.kernel.kernels[2], d) | ||||||||
end | ||||||||
|
||||||||
kappa(κ::GaborKernel, x, y) = kappa(κ.kernel, x, y) | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was wondering why without this the test Apparently, There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. That's not something we want to do since |
||||||||
|
||||||||
kappa(κ::GaborKernel, x, y) = kappa(κ.kernel, x ,y) | ||||||||
metric(::GaborKernel) = Euclidean() | ||||||||
|
||||||||
function kernelmatrix( | ||||||||
κ::GaborKernel, | ||||||||
|
@@ -76,3 +80,6 @@ function kerneldiagmatrix( | |||||||
obsdim::Int=defaultobs) #TODO Add test | ||||||||
kerneldiagmatrix(κ.kernel, X; obsdim=obsdim) | ||||||||
end | ||||||||
|
||||||||
Base.show(io::IO, κ::GaborKernel) = print(io, "Gabor Kernel (ell = ", κ.ell, ", p = ", κ.p, ")") | ||||||||
|
Uh oh!
There was an error while loading. Please reload this page.