Skip to content
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

first go at extending the GibbsKernel to work with other base kernels #406

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/kernels/gibbskernel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@

GibbsKernel(; lengthscale) = GibbsKernel(lengthscale)

function (k::GibbsKernel)(x, y)
function (k::GibbsKernel)(x, y, base_kernel::Kernel=SqExponentialKernel)

Check warning on line 39 in src/kernels/gibbskernel.jl

View check run for this annotation

Codecov / codecov/patch

src/kernels/gibbskernel.jl#L39

Added line #L39 was not covered by tests
lengthscale = k.lengthscale
lx = lengthscale(x)
ly = lengthscale(y)
l = invsqrt2 * hypot(lx, ly)
kernel = (sqrt(lx * ly) / l) * with_lengthscale(SqExponentialKernel(), l)
kernel = (sqrt(lx * ly) / l) * with_lengthscale(base_kernel(), l)

Check warning on line 44 in src/kernels/gibbskernel.jl

View check run for this annotation

Codecov / codecov/patch

src/kernels/gibbskernel.jl#L44

Added line #L44 was not covered by tests
return kernel(x, y)
end