-
Notifications
You must be signed in to change notification settings - Fork 41
ConstantKernel Performance #432
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
devmotion
left a comment
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.
For consistency I think it would be good to change kappa to only(k.c) (IMO it is more reasonable to not depend on the type of the input). Can we test the performance in some reliable way to avoid regressions?
I'm happy with the PR otherwise, so I'll approve regardless of these two points.
You would need to add tests on the benchmark.jl in master first. |
Do I literally just need to add the |
|
edit: sorry, I thought we had AD-related performance checks somewhere. @devmotion @theogf would either of you mind if I add them in this PR? I guess we might as well start tracking this stuff. |
Codecov Report
@@ Coverage Diff @@
## master #432 +/- ##
==========================================
- Coverage 93.14% 92.99% -0.15%
==========================================
Files 52 52
Lines 1210 1214 +4
==========================================
+ Hits 1127 1129 +2
- Misses 83 85 +2
Continue to review full report at Codecov.
|
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sure but I am not sure if it works if you change the benchmark file in the PR before in the doing it in master |
|
Ahh okay. I'll merge as-is then, and address benchmarking later. |
|
Docs fail because of
It looks one cannot add [EDIT:] Using |
|
Ahh okay. I'll just go with |
…JuliaGaussianProcesses/KernelFunctions.jl into wct/constant-kernel-performance
|
I opened an issue in |
|
Ah, that's an unfortunate upstream bug it seems (with an easy fix probably?). I guess we could just use a full matrix or |
|
It seems a bit unfortunate to not exploit the performance benefits, only because it breaks this example. |
|
I agree that it's a shame, but I'm still inclined to merge when CI passes, unless there are strong objections. We can always improve once stuff is fixed in FillArrays. |
|
I made an issue to remember. |
|
No strong objections, just a bit sad 😢 I'm looking forward to changing it to |
Summary
I found a lovely pathological Zygote-related performance problem.
Proposed changes
Optimisations for
kernelmatrixfor the ConstantKernelWhat alternatives have you considered?
The only other option is to improve Zygote's handling of
map. Unfortunately I can't see Zygote improving here in the immediate future (I certainly don't have time to look into it right now).Breaking changes
None
Performance
Here's a demo of how awful the performance is at the minute vs this PR:
You get similar results for the two-argument method of
kernelmatrix.