-
-
Notifications
You must be signed in to change notification settings - Fork 26k
[NoMRG] evaluate minimal implementation for sklearn estimator #18811
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
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
Have you ever seen this kind of pytest error before?
|
noop, I don't know if this is linked with running a test calling |
That error appears when the id of tests are not the same across processes when using |
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 new test for the minimal estimators. I think we should add an estimator checks that checks that if a model has a predict
method, then either is_classifier
or is_regressor
should return True both not both at the same time and not neither of them.
def __getstate__(self): | ||
return self.__dict__.copy() | ||
|
||
def __setstate__(self, state): | ||
self.__dict__.update(state) |
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 think you can just remove those methods, no?
@@ -2251,8 +2331,7 @@ def check_classifiers_predictions(X, y, name, classifier_orig, | |||
(classifier, ", ".join(map(str, y_exp)), | |||
", ".join(map(str, y_pred)))) | |||
|
|||
# training set performance | |||
if name != "ComplementNB": | |||
if not api_only and name != "ComplementNB": |
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.
@NicolasHug we are missing this check in the api_only
PR. However, there is something fishy here because either I am passing api_only=True
, this if
statement is run. I will investigate
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's because api_only
isn't passed in the calls to check_classifiers_predictions
. I'll update the other PR, thanks for noting
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.
We did not pass api_only
in the other when calling this function in check_classifiers_classes
.
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 was 16 seconds too slow :)
The only issue here is that my test should be placed in |
Yes we could move |
for the record I thought we already had this, but maybe I was hallucinating. I think we certainly need it. Maybe having at least one constructor argument would be good? |
I am closing this PR but I will introduce the test with minimal estimator implementation.
I think this is a good point. It would even be more meaningful to test |
Tests in CI pipeline return error: Different tests were collected between gw0 and gw1 For details and similar situation see:scikit-learn#18811 (comment)
Build on the top of:
_safe_tags
: TST introduce _safe_tags for estimator not inheriting from BaseEstimator #18797api_mode
: [MRG] MNT Api only mode in check_estimator #18582This PR is to evaluate what is the minimal implementation required for a compatible estimator (Regressor/Classifier/Transformer) which would not inherit from
BaseEstimator
.The relevant changes are in
test_estimator_checks.py
in the functiontest_check_estimator_minimal