-
Notifications
You must be signed in to change notification settings - Fork 36
Fix Independent MOKernel for single dimension input #144
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
Fails for ```julia N = 100 x = rand(Uniform(-1, 1), N) X = MOInput(x, 2) k = IndependentMOKernel(MaternKernel()) k(X, X) #error ```
Nice catch! Could you also add a test for this? |
@theogf Is this fine? |
Looks good! You can use |
Is this a custom thing we define in KernelFunctions? I have never seen it in Base 🤔 IMO you could just remove |
I think Edit: There is no such thing as |
I am sorry! I am at the beach so i did not double check 😅. I meant |
Wait, @sharanry could you explain to me why this is failing? I'm unclear why the previous implementation is incorrect 😬 . In particular, why is the solution you've implemented the correct one? |
Previously, |
Oh, I see. Would the following not be sufficient: function (k::IndependentMOKernel)(x::Tuple{Any, Int}, y::Tuple{Any, Int})
if last(x) == last(y)
return k.kernel(first(x), first(y))
else
return appropriate_zero
end
end i.e. I'm not sure that we need two methods, or to assume that the wrapped kernel requires vector inputs. |
That should be sufficient. However, we wouldn't have any checks for the first element of the tuple as you point out. I like it as it is definitely a less constrained way. Shall I start a new PR for this? |
Do we need a check on the type of the first element of the tuples? Can they not generally be anything?
That would be good -- better to address this sooner rather than later :) |
I guess not. This is should make the kernels more flexible. For other non-multi-output kernels we do not really perform any check for the inputs. |
Fails for