FIX/ENH CheckingClassifier support parameters and sparse matrices#17259
FIX/ENH CheckingClassifier support parameters and sparse matrices#17259NicolasHug merged 11 commits intoscikit-learn:masterfrom
Conversation
|
Is it possible to add a default |
Yes, I was doing it :). I just pushed. Now I have to check what are the related failures. |
|
@adrinjalali @NicolasHug @thomasjpfan @jeremiedbb It would be cool if you could have a quick look at this. It will unlock #17233. It does not really change any behaviour and this is just an internal utility for the moment. |
NicolasHug
left a comment
There was a problem hiding this comment.
thanks @glemaitre , only nits, LGTM
| y_pred = clf.predict(X) | ||
| assert_array_equal(y_pred, np.zeros(y_pred.size, dtype=np.int)) | ||
|
|
||
| assert clf.score(X) == pytest.approx(0) |
There was a problem hiding this comment.
we should be able to check for strict equality here
There was a problem hiding this comment.
Since they are floating-point, why would you make strict equality?
There was a problem hiding this comment.
because they're hard-coded ones and zeros. There's not going to be any floating issue there
There was a problem hiding this comment.
I still consider this a bad pattern to have in the code.
|
|
||
| y_proba = clf.predict_proba(X) | ||
| assert y_proba.shape == (150, 3) | ||
| assert_allclose(y_proba[:, 0], 1) |
There was a problem hiding this comment.
same here and for most other checks
There was a problem hiding this comment.
proba are also floating point
Co-authored-by: Nicolas Hug <contact@nicolas-hug.com>
Co-authored-by: Nicolas Hug <contact@nicolas-hug.com>
Co-authored-by: Nicolas Hug <contact@nicolas-hug.com>
jeremiedbb
left a comment
There was a problem hiding this comment.
lgtm. @NicolasHug feel free to merge if you think all your comments have been addressed.
|
Thanks @glemaitre |
Reference Issues/PRs
Required for #17233
What does this implement/fix? Explain your changes.
leninstead of_num_samples)check_*functions.predict_probaanddecision_functionto be compliant with classifier API