-
Notifications
You must be signed in to change notification settings - Fork 38
add gibbskernel example to prior example script #375
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
add gibbskernel example to prior example script #375
Conversation
@@ -120,6 +120,7 @@ kernels = [ | |||
LinearKernel(), | |||
compose(PeriodicKernel(), ScaleTransform(0.2)), | |||
NeuralNetworkKernel(), | |||
GibbsKernel(x -> exp(sin.(x))), |
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.
Usually we prefer the keyword argument constructor since it is a bit clearer. You can also simplify the lengthscale function a bit (broadcasting is only useful if x
are vectors - in which case exp(sin.(x))
would fail though):
GibbsKernel(x -> exp(sin.(x))), | |
GibbsKernel(; lengthscale=exp ∘ sin), |
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 think we should generally handle vectors so something like exp(sum(sin, x))
maybe?
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.
It seemed the example only deals with scalar inputs but maybe I didn't check it carefully enough. If vectors occur as inputs, then I agree something like x -> exp(sum(sin, x))
or x -> sum(exp ∘ sin, x)
should be used.
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.
Thanks both for the helpful information and suggestions. I went with x -> sum(exp ∘ sin, x)
and checked locally that it works in a notebook so hopefully the CI will be happy.
make the GibbsKernel example more robust with thanks to @devmotion and @theogf
Can this be merged? |
@Cyberface, unfortunately since this is from a fork we cannot visualize the result... Could you run the docs locally and post here a screenshot of the resulting GP prior? :) |
@theogf thanks for letting me know what to do, I managed to build the docs using the README in the docs dir. The GP prior example page is quite long but there should only be two difference.
|
That looks great! Thanks for the addition |
Codecov Report
@@ Coverage Diff @@
## master #375 +/- ##
===========================================
- Coverage 89.23% 69.54% -19.69%
===========================================
Files 52 52
Lines 1198 1192 -6
===========================================
- Hits 1069 829 -240
- Misses 129 363 +234
Continue to review full report at Codecov.
|
Summary
Adding an example how to use the Gibbs Kernel in the prior example.
The Gibbs kernel has a lengthscale function as it's parameter.
I just chose a simple function for demonstration purposes i.e.
l(x) = exp(sin(x))
.Proposed changes
examples/gaussian-process-priors/script.jl
What alternatives have you considered?
Could make a separate example and will probably do that when I have a working version of the Gibbs kernel that also learns the lengthscale function.
Breaking changes
None