-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
FIX accept meta-estimator in SelfTrainingClassifier #19126
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
@@ -207,8 +207,11 @@ def fit(self, X, y): | |||
|
|||
if self.n_iter_ == 1: | |||
# Only validate in the first iteration so that n_iter=0 is | |||
# equivalent to the base_estimator itself. | |||
_validate_estimator(self.base_estimator) | |||
# equivalent to the base_estimator_ itself. |
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.
@oliverrausch Do you recall what is the meaning of this line and the previous one?
It was not obvious to me.
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.
May I suggest:
# Only validate the fitted estimator of the first iteration.
Actually since the validation is really cheap, I would not mind simplifying this code and removing the if self.n_iter_ == 1:
condition.
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
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
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 (once the review comments are addressed).
@@ -207,8 +207,11 @@ def fit(self, X, y): | |||
|
|||
if self.n_iter_ == 1: | |||
# Only validate in the first iteration so that n_iter=0 is | |||
# equivalent to the base_estimator itself. | |||
_validate_estimator(self.base_estimator) | |||
# equivalent to the base_estimator_ itself. |
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.
May I suggest:
# Only validate the fitted estimator of the first iteration.
Actually since the validation is really cheap, I would not mind simplifying this code and removing the if self.n_iter_ == 1:
condition.
LGTM. For the sake of sharing, the solution I had in my mind for #19119 was to change the order of the following two lines in
to
|
@riyadhctg The changes that you proposed is in the |
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com> Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com> Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
closes #19119
SelfTrainingClassifier
did not accept nested estimators that did not exposepredict_proba
.One fix is to validate a fitted estimator where we know if
predict_proba
will be then available.