-
Notifications
You must be signed in to change notification settings - Fork 36
@kernel macro for creating kernel #38
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
Am busy this week. Will take a look early next week. |
Unable to review at the minute as the julia> @kernel 5 * Matern32Kernel() l=5.0
ERROR: LoadError: UndefVarError: kw not defined
Stacktrace:
[1] macro expansion at ./show.jl:562 [inlined]
[2] @kernel(::LineNumberNode, ::Module, ::Expr, ::Any) at /Users/willtebbutt/.julia/dev/KernelFunctions/src/kernels/kernel_macro.jl:8
in expression starting at REPL[13]:1 |
Sorry about that! it should be fixed now |
This seems good: julia> (@kernel Matern32Kernel() l=[5.0, 2.0]) + (@kernel Matern52Kernel() l=[4.0, 3.0])
Sum of 2 kernels:
- (w=1.0) Matern32Kernel
- ARDTransform{Float64,2}([5.0, 2.0])
- (w=1.0) Matern52Kernel
- ARDTransform{Float64,2}([4.0, 3.0]) (the printing is already quite cool, nice work!) This I found surprising: julia> @kernel (Matern32Kernel() + Matern52Kernel()) l=[5.0, 4.0]
ERROR: MethodError: no method matching transform(::KernelSum, ::Array{Float64,1})
Closest candidates are:
transform(::BaseKernel, ::AbstractArray{T,1} where T) at /Users/willtebbutt/.julia/dev/KernelFunctions/src/kernels/transformedkernel.jl:22
Stacktrace:
[1] top-level scope at REPL[26]:1 Maybe it's just the case that Also, this doesn't seem right: julia> @kernel Matern32Kernel() l=5.0
Matern32Kernel
- Scale Transform s=5.0
edit: I just found this last example confusing because I was confused as to what `ScaleTransform` is doing -- it's got a very similar name to `ScaledKernel`. It might be better for change how some of this prints, but that's for a separate PR I would imagine. |
Yeah somehow I got fixed in the idea that
I don't understand why? Should we start consider the parameter |
Sorry, no, I just misunderstood what is going on. I think it might be better to modify how this is printed a little bit, but that can be addressed in a separate issue. Please ignore my third point :) |
Co-authored-by: David Widmann <[email protected]>
In terms in UI design, is it preferable to force to have a keyword, e.g. |
Initially I thought |
This is true I can completely remove the scaling. If one put it inside of outside would not matter. |
…2Kernel alias (#213) * various edits for clarity and typos * remove reference to not-yet-implemented feature (#38) * adds Matern12Kernel as alias for ExponentialKernel (in line with the explicitly defined Matern32Kernel and Matern52Kernel) and gives all aliases docstrings * incorporates the lengthscales explanation from #212. Co-authored-by: David Widmann <[email protected]>
Goodbye little one! |
So I started creating a first version of the
@kernel
macro which for now follows this syntax:So the transform is given either by a keyword
l=2.0
,l=[2.0,3.0]
etc or directly by a parameterFor the kernel parameters they are restricted to be in the Kernel constructor
Edit : Left to do :