[MRG+1] Adding multi output checks to common tests#13392
[MRG+1] Adding multi output checks to common tests#13392glemaitre merged 5 commits intoscikit-learn:masterfrom
Conversation
5328660 to
b720e06
Compare
TomDLT
left a comment
There was a problem hiding this comment.
Not sure about these tag changes (#13392 (comment)). ping @amueller
33aa2ab to
8618a0e
Compare
TomDLT
left a comment
There was a problem hiding this comment.
Thanks for the update !
I like much more your Mixin fix now.
You will also need to add en entry in https://github.com/scikit-learn/scikit-learn/blob/master/doc/whats_new/v0.21.rst#changes-to-estimator-checks, writing the change, this PR number and your GitHub name.
9450697 to
499fc5b
Compare
|
I wonder if requires_positive_data is implied by accepting pairwise data in
all cases.
|
|
But there's certainly nothing wrong with conditional tags
|
@jnothman - right, is there some other way to know? |
TomDLT
left a comment
There was a problem hiding this comment.
LGTM
We just need to wait for a second review.
85cf3c0 to
c53179d
Compare
|
Ping! :) |
6a222f3 to
9a482b6
Compare
c9ceb6e to
3f3671b
Compare
|
I've rebased and maybe we could get it merged in v0.22? :) |
14df99b to
86e6baf
Compare
|
Rebased and fixed new issues. Since things changed it might be good to do another review. |
sklearn/neighbors/regression.py
Outdated
| metric_params=metric_params, n_jobs=n_jobs, **kwargs) | ||
| self.weights = _check_weights(weights) | ||
|
|
||
| def _more_tags(self): |
There was a problem hiding this comment.
Shouldn't this be handled by _pairwise?
|
The reason why we need to add the intermediate classes into the hierarchy is because we don't add the mixins to the correct (that is left) side, and so we can't have nice things #14044? Would it be feasible / sensible to actually change the order of mixins and allow overwriting tags? That would simplify a bunch of this, right? |
|
posted #14635 which will probably simplify this |
|
ok this has a chance to be merged soon and would make this much easier: #14884 |
|
@jnothman - will try to finish this tonight. Sorry for the delay :) |
0f23831 to
1969e70
Compare
|
I'm not sure if I got the general approach right but I have:
Please review :). Thanks for pushing this @glemaitre @jnothman @amueller! |
1969e70 to
fd6c04d
Compare
glemaitre
left a comment
There was a problem hiding this comment.
There is a couple of missing assert in the tests and I would add meaningful error message.
It would ease debugging when rolling your own estimator and that check_estimator is failing.
sklearn/utils/estimator_checks.py
Outdated
| estimator.fit(X, y) | ||
| y_pred = estimator.predict(X) | ||
|
|
||
| assert y_pred.dtype == np.dtype('float') |
There was a problem hiding this comment.
Let's add an error message
"Multi-output predictions by a regressor are expected to be floating-point precision. Got {} instead".format(y_pred.dtype)
There was a problem hiding this comment.
We can also have a similar style as before
assert y_pred.dtype.kind == 'f'There was a problem hiding this comment.
Had to set this to 'float64'.
glemaitre
left a comment
There was a problem hiding this comment.
So a couple of changes required.
|
Thanks @glemaitre. I'll do this tonight. |
[MRG] Adding multi output checks to common tests (scikit-learn#13187) Removing redundant tests. Adding tests to check_classifier_multioutput and check_regressor_multioutput.
Co-Authored-By: Guillaume Lemaitre <g.lemaitre58@gmail.com>
c1457ad to
8cef195
Compare
|
@glemaitre done, please review. :) |
bb8f4eb to
78f3938
Compare
78f3938 to
8eabe3b
Compare
|
@glemaitre ping :) |
|
Thanks @rok |
|
Thanks all! :) |
Reference Issues/PRs
Fixes #13187.
Changes
This implements new classifier and regressor checks to test for multi-output support in common tests.
Some random forest and tree classifier test are removed as they are duplicating this functionality.