FIX add n_targets allowing consistent shape prediction before calling fit in GPR - #23099
Merged
Conversation
Contributor
Author
|
Hi @glemaitre, could you help take a look at this PR, thank you |
glemaitre
reviewed
Jun 22, 2022
glemaitre
left a comment
Member
There was a problem hiding this comment.
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]>
thomasjpfan
reviewed
Jan 18, 2023
jeremiedbb
approved these changes
May 26, 2023
jeremiedbb
left a comment
Member
There was a problem hiding this comment.
Thanks for the PR @MaxwellLZH. I directly pushed the remaining requested change. LGTM.
Member
|
@thomasjpfan are you happy with the latest updates ? |
glemaitre
reviewed
May 31, 2023
| 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. " |
Member
There was a problem hiding this comment.
I would favor a more literal error:
The number of targets seen in `y` is different from the parameter `n_targets`.
Got ...
glemaitre
approved these changes
May 31, 2023
glemaitre
left a comment
Member
There was a problem hiding this comment.
Still my +1 on this one. Just a nitpick regarding the error message raised.
Member
|
LGTM. Merging since the changes requested by @thomasjpfan have been implemented. |
REDVM
pushed a commit
to REDVM/scikit-learn
that referenced
this pull request
Nov 16, 2023
…ng `fit` in GPR (scikit-learn#23099) Co-authored-by: Guillaume Lemaitre <[email protected]> Co-authored-by: Jérémie du Boisberranger <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.