-
Notifications
You must be signed in to change notification settings - Fork 562
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
slight improvements to IndexKernel for the rank == 0 (diagonal) case #2141
base: main
Are you sure you want to change the base?
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.
In principle it seems reasonable enough to me to support this.
However, looking at forward
and _eval_covar_matrix
the code as is will cause some issues. Namely in _eval_covar_matrix
(called from forward
) we will get an AttributeError
when we try this from self.covar_factor
. Which means that we should also add a unit test case to cover the rank==0
behavior.
Taking a step back, if we handled that correctly, we probably shouldn't return an InterpolatedLinearOperator
in forward
- or at least we'd want to special case InterpolatedLinearOperator
to handle a diagonal base_linear_op
(it doesn't seem that this is currently the case).
I've added a branch to |
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, but I'll let @Balandat make the final approval.
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. I think at least some of the special casing of using a DiagLinearOperator
is actually happening inside InterpolatedLinearOperator
so we'll probably get some gains there already.
I guess I would still like to see this covered by a unit test though :) |
This PR tweaks
IndexKernel
to have slightly better performance/behavior in the corner case ofrank == 0
, where the underlying covariance matrix is diagonal. Although this case is atypical from the point of view of multitask GPs, I have found this construction useful as a component of larger covariance structures.Two changes are proposed:
covar_factor
parameter (the low-rank component whenrank > 0
) whenrank > 0
rank == 0
case, thecovar_matrix()
method returns aDiagLinearOpeator
rather than aPsdSumLinearOperator(RootLinearOperator, DiagLinearOperator)