-
Notifications
You must be signed in to change notification settings - Fork 33
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
Some improvement and additions to MO kernels #354
Some improvement and additions to MO kernels #354
Conversation
Thanks for your interest in KernelFunctions:) could you provide a bit more context on what hadn't been working for you / what you're trying to achieve / work around with your changes? |
Sorry, of course. For this set of changes, my changes aim to make sure that the kernels are type stable, as well as propose a specific implementation for the In additional commits, I would like to introduce a new type of MO kernel, the Group-Invariant-Matrix (GIM) kernel (Reisert, 2007). |
Thanks for uploading the timing data -- pretty clear win with the new versions. This kind of optimisation is exactly the kind of PR we're keen to have, so please rename |
How about similar definitions for This is probably a source of inconsistency that is likely to pop up again in the future: would it perhaps be better to generally define |
That would be a nice way to do it, but unfortunately
This makes sense to me though. |
Worked in most of the changes, will look at the lazy Kronecker product now. |
It seems that Kronecker.jl is already an optional dependency of KernelFunctions. I have to think about how to implement the matrix kernels in a way that works with the optional dependency. |
Please do feel free not to worry about it for now if it's not high on your priority list -- we can always revisit it later. |
@Crown421 you'll have to accept reviewdog's formatting suggestions (or run JuliaFormatter locally):) |
Ok, did some reworking using traits, now there is less code duplication, and getting the lazy Kronecker product has to be made explicit. |
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.
Many thanks for reducing the size of this PR, it's now much more easily digestible.
I've left a couple of minor style-related things, but I think they're fairly inconsequential. The main thing I'd like to get sorted is the argument names for _kronkernelmatrix
, and the function's name itself.
src/mokernels/independent.jl
Outdated
return κ.kernel(x, y) * (px == py) | ||
end | ||
|
||
function _kronkernelmatrix(Ktmp, B, ::MOInputIsotopicByFeatures) |
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 agree with @st-- regarding argument names in particular -- Kfeatures
and Koutputs
are quite a bit more informative than Ktmp
and B
. The function name also makes more sense to me.
Co-authored-by: willtebbutt <wt0881@my.bristol.ac.uk>
Co-authored-by: willtebbutt <wt0881@my.bristol.ac.uk>
Co-authored-by: willtebbutt <wt0881@my.bristol.ac.uk>
Co-authored-by: willtebbutt <wt0881@my.bristol.ac.uk>
Co-authored-by: willtebbutt <wt0881@my.bristol.ac.uk>
Ok, I have removed the in place tests, and changed a few more small things.
Re function names, the helper function should not really be visible to a user (which I tried to indicate with the leading |
The rationale is that Could you please remove the |
Actually, one other quick thing.
I think sticking the word "helper" on the end was a good move. Could you please rename to |
Alright, done all of those things. I am sorry that this was such a long process, I learned quite a bit though. Will do the pull requests in a bit. |
No problem at all. Thanks for sticking with it and working through everything. The first PR always takes as while -- your follow up PRs will almost certainly progress much faster now that we all know what's going on better. |
@Crown421 looks like there's some |
I think I fixed it? |
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.
LGTM. Will merge + tag.
I have been using KernelFunctions in my research, but have been building some more or less hacky solution on top of it to facilitate Multi-Output GPs.
Here I would like to move some of that work into this package to streamline my own code and get it ready for publication.
The following is a start, with more things to come soon. I have added tests as I thought appropriate, but ran into a segfault caused by the AD test function. I hope that this was a local problem.