Skip to content

[MRG] Avoid solve_triangular computation in GaussianProcessRegressor predict when return_std and return_cov are false #31431

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

RafaAyGar
Copy link

Reference Issues/PRs

Fixes #31374

What does this implement/fix? Explain your changes.

This PR avoids the unnecessary execution of the solve_triangular() function inside the GaussianProcessRegressor() predict() function when the arguments return_std and return_cov are set to False.
A non-regression test is also implemented to check that y_mean is returned alone (not a tuple) when return_std=False and return_cov=False. This behavior also existed previously and was not covered by the tests.

Any other comments?

N/A.

Copy link

github-actions bot commented May 26, 2025

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: d7f78ac. Link to the linter CI: here

@lesteve
Copy link
Member

lesteve commented Jun 10, 2025

Thanks for the PR!

The fix looks fine.

Could you do a quick benchmark with some toy data to show that this PR actually fixes the performance issue reported in #31374?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Suggested fix: GaussianProcessRegressor.predict wastes significant time when both return_std and return_cov are False
2 participants