Thanks to visit codestin.com
Credit goes to github.com

Skip to content

FIX Ensure that GaussianProcessRegressor predict method does not modify input #24405

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

Merged

Conversation

OmarManzoor
Copy link
Contributor

Reference Issues/PRs

Fixes #24340

What does this implement/fix? Explain your changes.

  • Ensure that GaussianProcessRegressor predict method does not modify the input when return_std=True
  • In order to achieve this a copy of the input matrix X is passed to the diag method in the return_std block.
  • A test case is added based on the code reported in the issue.

Any other comments?

None

Copy link
Member

@glemaitre glemaitre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to have a entry in the v1.2.rst changelog to acknowledge the bug.

@glemaitre glemaitre changed the title Ensure that GaussianProcessRegressor predict method does not modify input FIX Ensure that GaussianProcessRegressor predict method does not modify input Sep 9, 2022
@glemaitre glemaitre requested review from glemaitre and removed request for glemaitre September 9, 2022 12:13
Copy link
Member

@glemaitre glemaitre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @OmarManzoor

Copy link
Member

@jeremiedbb jeremiedbb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @OmarManzoor. I just have a suggestion about the custom kernel designed for the test

Copy link
Member

@jeremiedbb jeremiedbb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @OmarManzoor

@jeremiedbb jeremiedbb merged commit e04fb58 into scikit-learn:main Sep 12, 2022
@OmarManzoor OmarManzoor deleted the gpr_predict_input_mutation_fix branch September 12, 2022 13:41
glemaitre pushed a commit to glemaitre/scikit-learn that referenced this pull request Sep 12, 2022
Claes1981 added a commit to Claes1981/scikit-optimize that referenced this pull request Jul 13, 2024
…ct method, just to be safe. (I'm not sure the bug affect Chess-tuning-tools).
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.

BUG: GaussianProcessRegressor.predict inplace modifies input X, when passed via kernel
3 participants