-
-
Notifications
You must be signed in to change notification settings - Fork 26.5k
FIX add n_targets allowing consistent shape prediction before calling fit in GPR
#23099
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
Conversation
|
Hi @glemaitre, could you help take a look at this PR, thank you |
glemaitre
left a comment
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.
It looks good. Could you add a what's new entry in 1.2.
Note that this is a bug fix rather than a feature.
n_targets for GPRn_targets allowing consistent shape prediction before calling fit in GPR
Co-authored-by: Guillaume Lemaitre <[email protected]>
Co-authored-by: Guillaume Lemaitre <[email protected]>
Co-authored-by: Guillaume Lemaitre <[email protected]>
Co-authored-by: Guillaume Lemaitre <[email protected]>
Co-authored-by: Guillaume Lemaitre <[email protected]>
Co-authored-by: Guillaume Lemaitre <[email protected]>
Co-authored-by: Guillaume Lemaitre <[email protected]>
Co-authored-by: Guillaume Lemaitre <[email protected]>
Co-authored-by: Guillaume Lemaitre <[email protected]>
Co-authored-by: Guillaume Lemaitre <[email protected]>
Co-authored-by: Guillaume Lemaitre <[email protected]>
Co-authored-by: Guillaume Lemaitre <[email protected]>
glemaitre
left a comment
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
jeremiedbb
left a comment
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.
Thanks for the PR @MaxwellLZH. I directly pushed the remaining requested change. LGTM.
|
@thomasjpfan are you happy with the latest updates ? |
sklearn/gaussian_process/_gpr.py
Outdated
| n_targets_seen = y.shape[1] if y.ndim > 1 else 1 | ||
| if self.n_targets is not None and n_targets_seen != self.n_targets: | ||
| raise ValueError( | ||
| "Number of targets seen != n_targets. " |
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.
I would favor a more literal error:
The number of targets seen in `y` is different from the parameter `n_targets`.
Got ...
glemaitre
left a comment
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.
Still my +1 on this one. Just a nitpick regarding the error message raised.
|
LGTM. Merging since the changes requested by @thomasjpfan have been implemented. |
…ng `fit` in GPR (scikit-learn#23099) Co-authored-by: Guillaume Lemaitre <[email protected]> Co-authored-by: Jérémie du Boisberranger <[email protected]>
Fixes #22430
Reference Issues/PRs
This PR adds a new argument
n_targetsforGaussianProcessRegressoras suggested in issue #22430 , which will be used to determine the output shape of bothpredictandsample_y, so the shape will be consistent before and after callingfitmethod.Any other comments?
I'm not sure if we should raise error during the fit process if the dimension of
ydoes not matchn_targets, since once we fit the model the output shape will be determined by the shape of y.