-
Notifications
You must be signed in to change notification settings - Fork 54
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
feat(gpjax/kernels/base.py): add diagonal #429
feat(gpjax/kernels/base.py): add diagonal #429
Conversation
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.
Thank you for opening your first PR into GPJax!
If you have not heard from us in a while, please feel free to ping @gpjax/developers
or anyone who has commented on the PR. Most of our reviewers are volunteers and sometimes things fall through the cracks.
You can also join us on Slack for real-time discussion.
For details on testing, writing docs, and our review process, please see the developer guide
We strive to be a welcoming and open project. Please follow our Code of Conduct.
Hi @stephen-huan - thanks for adding this. Would you be able to include a unit test for this function please? |
2118ca9
to
57cfe67
Compare
@thomaspinder I've added tests, sorry for the long delay! |
57cfe67
to
e697365
Compare
@thomaspinder any progress on this PR? I added consistency tests that are tangentially related to this PR: now I also noticed a check of |
Thanks @stephen-huan - nice to see this included in GPJax! |
Type of changes
Checklist
poetry run pre-commit run --all-files --show-diff-on-failure
before committing.Description
AbstractKernel
has wrappers forcross_covariance
andgram
but not fordiagonal
, when all three are defined byAbstractKernelComputation
(diagonal
is actually concretely implemented byAbstractKernelComputation
).This PR adds
diagonal
toAbstractKernel
.Although the change is trivial, I believe it's important for the following reasons.
Currently, the way to get the diagonal of a kernel matrix efficiently would be code like
Other than being needlessly verbose, this obscures the fact that most of the
*Computation
classes (DiagonalKernelComputation
, etc.) could be used in place ofDenseKernelComputation
without changing the underlying implementation fromAbstractKernelComputation
. Instead, code likeis cleaner and would allow specific kernels to provide a more efficient, specialized implementation (for example, the Matern family has a unit diagonal no matter the input data).