feat(Voting): Allow a prefit
option to VotingClassifier/Regressor
#28434
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
prefit
option missing for voting? #12297What does this implement/fix? Explain your changes.
This feature enables the user to pass in prefit estimators to both
VotingClassifier
andVotingRegressor
by specifyingprefit=True
.The
VotingX
is still required to havefit()
called on it to do validation of the prefit estimators but it does not perform model fitting during this period.Along with this, I've provided some basic first testing to ensure that the prefit estimators work equally if fit outside vs inside the Voter and validation checks during the call to
VotingX.fit()
to ensure that that prefit estimators are aligned in terms of the data that can flow through them.Any other comments?
This is mainly a draft PR to backup my comment left on issue #12297 with an initial implementation. There are likely a lot of missing features and issues that could arise.
Below is a list of issues that need to be resolved for this feature to integrate properly or issues that need to be discussed.
Issues
VotingX(estimators, prefit=True).fit(X, y)
, should theVoter
validate that the estimators are aligned with eachother, or with the passed inX, y
, in terms of attributes liken_features_in_
andn_feature_names_
?clone
behavior of this estimator, in relation to this comment by @amueller, linking to API Freezing estimators #8370Voter
with respect to the suite of estimator tests that exist for scikit-learn integrations.As a meta-level question, should there exist a separate
PrefitVotingX
to alleviate some of this issues and simplify internals, at the expense of introducing a new estimator class?TODOs if accepted
..versionadded::
to the docstrings