FIX Validate estimators in Voting{Classifier,Regressor}#30649
Merged
lesteve merged 5 commits intoJan 21, 2025
Conversation
OmarManzoor
approved these changes
Jan 15, 2025
Contributor
OmarManzoor
left a comment
There was a problem hiding this comment.
Otherwise LGTM. Thanks @thomasjpfan
Co-authored-by: Omar Salman <omar.salman2007@gmail.com>
lesteve
reviewed
Jan 17, 2025
| def _validate_estimators(self): | ||
| if len(self.estimators) == 0: | ||
| if len(self.estimators) == 0 or not all( | ||
| isinstance(item, tuple) and isinstance(item[0], str) |
Member
There was a problem hiding this comment.
Not sure how much we care, but the previous code was working fine with lists rather than tuple and with this PR it would be an error, i.e. when using estimators=[['name', LogisticRegression()]] rather than estimators=[('name', LogisticRegression())]
I guess this is documented as a list of tuples but you never know people may be using list of lists in the wild ...
Member
There was a problem hiding this comment.
I'm +1 to silently allow lists as well.
For instance in Pipeling, ColumnTransformer, ... we silently allow tuples in addition to lists.
lesteve
approved these changes
Jan 21, 2025
Member
|
Thanks, let's merge this one! |
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.
Reference Issues/PRs
Fixes #30622
What does this implement/fix? Explain your changes.
This PR adds a little more validation to make sure
estimatorsis correct inVotingClassiferandVotingRegressor.