Skip to content
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

Rebase Inducing Points Using QR #476

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

akleeman
Copy link
Collaborator

@akleeman akleeman commented Feb 2, 2024

Prereq: #475

The existing rebase_inducing_points method relied heavily on the fit_from_prediction method. It was computing a prediction of the new inducing points, then calling fit_from_prediction on that result,

fit_from_prediction(new_inducing_points, fit_model.predict(new_inducing_points).joint());

This involved a few questionable steps. For example, if the prediction is not full rank (which could happen when you have numerically identical inducing points) then this step:

    const Eigen::SerializableLDLT C_ldlt(prediction.covariance);
    const Eigen::MatrixXd sigma_inv_sqrt = C_ldlt.sqrt_solve(K_zz);

could become unstable since C_ldlt may have near zero diagonals and we then invert them in C_ldlt.sqrt_solve.

This PR switches to a new approach which is more directly based on the QR decomposition. While there is still a step involving the cholesky of a potentially singular matrix, the subsequent decomposition is not used in any inverses, so the consequences should be much smaller.

A description of the algorithm was added to the documentation (screenshot below)

image

@akleeman akleeman force-pushed the akleeman/rebase_inducing_points branch from 9617994 to 33f3f78 Compare February 2, 2024 22:06
@akleeman
Copy link
Collaborator Author

akleeman commented Feb 3, 2024

I tried pulling this into our models and it actually significantly changed performance 🤔. Going to need to root cause why, in the meantime I won't merge this (but don't let that stop you from taking a look with an eye out for any mistakes I may have made).

@peddie
Copy link
Contributor

peddie commented Feb 4, 2024

I don't see any obvious performance missteps here. But Householder QR is always twice as expensive as an equivalently-sized Cholesky decomposition.

I am glad to see the permutation matrix cleanups going in -- might it make sense to pull those out as a separate first PR? I would happily merge that stuff, and it would also leave fewer changes to examine for performance.

@akleeman
Copy link
Collaborator Author

akleeman commented Feb 4, 2024

@peddie #475

@akleeman
Copy link
Collaborator Author

akleeman commented Feb 4, 2024

I don't see any obvious performance missteps here. But Householder QR is always twice as expensive as an equivalently-sized Cholesky decomposition.

Both this and the existing require LDLT and QR decompositions. But it is true that this version will likely be slower since it requires two LDLTs and a larger QR.

That said, this approach opens the opportunity to do both a rebase and update in one single step (not implemented yet) at which point the cost might even out?

@jbangelo jbangelo removed their request for review August 6, 2024 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants