Skip to content

[MRG+1] Adding multi output checks to common tests - #13392

Merged
glemaitre merged 5 commits into
scikit-learn:masterfrom
rok:adding_multi-output_checks_to_common_tests
Oct 1, 2019
Merged

glemaitre merged 5 commits into
scikit-learn:masterfrom
rok:adding_multi-output_checks_to_common_tests

Conversation

@rok

@rok rok commented Mar 5, 2019

Copy link
Copy Markdown
Contributor

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.

Comment thread sklearn/utils/estimator_checks.py Resolved
Comment thread sklearn/utils/estimator_checks.py Resolved
Comment thread sklearn/utils/estimator_checks.py Resolved
Comment thread sklearn/utils/estimator_checks.py Resolved
Comment thread sklearn/utils/estimator_checks.py Resolved
@rok
rok force-pushed the adding_multi-output_checks_to_common_tests branch from 5328660 to b720e06 Compare March 7, 2019 14:39
@rok rok changed the title Adding multi output checks to common tests [MRG] Adding multi output checks to common tests Mar 7, 2019

@TomDLT TomDLT left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about these tag changes (#13392 (comment)). ping @amueller

Comment thread sklearn/neighbors/regression.py Resolved
Comment thread sklearn/utils/estimator_checks.py Resolved
Comment thread sklearn/base.py Resolved
Comment thread sklearn/linear_model/least_angle.py Resolved
@rok
rok force-pushed the adding_multi-output_checks_to_common_tests branch from 33aa2ab to 8618a0e Compare March 17, 2019 00:50

@TomDLT TomDLT left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@rok
rok force-pushed the adding_multi-output_checks_to_common_tests branch from 9450697 to 499fc5b Compare March 18, 2019 22:36
@jnothman

jnothman commented Mar 19, 2019 via email

Copy link
Copy Markdown
Member

@jnothman

jnothman commented Mar 19, 2019 via email

Copy link
Copy Markdown
Member

@rok

rok commented Mar 19, 2019

Copy link
Copy Markdown
Contributor Author

I wonder if requires_positive_data is implied by accepting pairwise data in all cases.

@jnothman - right, is there some other way to know?

@TomDLT TomDLT left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

We just need to wait for a second review.

Comment thread doc/whats_new/v0.21.rst Resolved
Comment thread sklearn/ensemble/tests/test_forest.py Resolved
@rok
rok force-pushed the adding_multi-output_checks_to_common_tests branch from 85cf3c0 to c53179d Compare March 28, 2019 19:32
Comment thread sklearn/utils/estimator_checks.py Resolved
@rok

rok commented Apr 3, 2019

Copy link
Copy Markdown
Contributor Author

Ping! :)

@rok
rok force-pushed the adding_multi-output_checks_to_common_tests branch from 6a222f3 to 9a482b6 Compare April 11, 2019 16:42
@rok
rok force-pushed the adding_multi-output_checks_to_common_tests branch 5 times, most recently from c9ceb6e to 3f3671b Compare May 9, 2019 23:43
@rok

rok commented May 10, 2019

Copy link
Copy Markdown
Contributor Author

I've rebased and maybe we could get it merged in v0.22? :)

@TomDLT TomDLT added this to the 0.22 milestone May 10, 2019
@rth
rth self-requested a review June 25, 2019 12:10
@rok
rok force-pushed the adding_multi-output_checks_to_common_tests branch 3 times, most recently from 14df99b to 86e6baf Compare July 20, 2019 21:46
@rok

rok commented Jul 20, 2019

Copy link
Copy Markdown
Contributor Author

Rebased and fixed new issues. Since things changed it might be good to do another review.

@amueller

Copy link
Copy Markdown
Member

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?

@amueller

Copy link
Copy Markdown
Member

posted #14635 which will probably simplify this

@amueller

amueller commented Sep 4, 2019

Copy link
Copy Markdown
Member

ok this has a chance to be merged soon and would make this much easier: #14884

@jnothman

Copy link
Copy Markdown
Member

With #14884 merged, and a bunch of nitpicks above, are you going to bring this to conclusion, @rok? Thanks.

@rok

rok commented Sep 20, 2019

Copy link
Copy Markdown
Contributor Author

@jnothman - will try to finish this tonight. Sorry for the delay :)

@rok
rok force-pushed the adding_multi-output_checks_to_common_tests branch 3 times, most recently from 0f23831 to 1969e70 Compare September 21, 2019 12:45
@rok

rok commented Sep 21, 2019 •

Copy link
Copy Markdown
Contributor Author

I'm not sure if I got the general approach right but I have:

  • moved mixins to the left
  • replaced intermediate classes by adding _more_tags to classes that inherit multioutput tag as True but should have it set to False. E.g. Lars is a multioutput class but LarsCV that inherits tags from Lars is not. We adjust LarsCV tags.

Please review :).

Thanks for pushing this @glemaitre @jnothman @amueller!

@rok
rok force-pushed the adding_multi-output_checks_to_common_tests branch from 1969e70 to fd6c04d Compare September 23, 2019 21:08

@glemaitre glemaitre left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread sklearn/utils/estimator_checks.py Resolved
Comment thread sklearn/utils/estimator_checks.py Resolved
Comment thread sklearn/utils/estimator_checks.py Resolved
Comment thread sklearn/utils/estimator_checks.py Resolved
Comment thread sklearn/utils/estimator_checks.py Resolved
Comment thread sklearn/utils/estimator_checks.py Resolved
Comment thread sklearn/utils/estimator_checks.py Outdated
estimator.fit(X, y)
y_pred = estimator.predict(X)

assert y_pred.dtype == np.dtype('float')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also have a similar style as before

assert y_pred.dtype.kind == 'f'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to set this to 'float64'.

Comment thread sklearn/utils/estimator_checks.py Resolved
@glemaitre
glemaitre self-requested a review September 24, 2019 08:43

@glemaitre glemaitre left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So a couple of changes required.

@rok

rok commented Sep 24, 2019

Copy link
Copy Markdown
Contributor Author

Thanks @glemaitre. I'll do this tonight.

rok and others added 3 commits September 24, 2019 18:15
[MRG] Adding multi output checks to common tests (scikit-learn#13187)

Removing redundant tests.
Adding tests to check_classifier_multioutput and check_regressor_multioutput.
@rok
rok force-pushed the adding_multi-output_checks_to_common_tests branch from c1457ad to 8cef195 Compare September 24, 2019 16:17
@rok

rok commented Sep 24, 2019

Copy link
Copy Markdown
Contributor Author

@glemaitre done, please review. :)

@rok
rok force-pushed the adding_multi-output_checks_to_common_tests branch 2 times, most recently from bb8f4eb to 78f3938 Compare September 24, 2019 16:55
@rok
rok force-pushed the adding_multi-output_checks_to_common_tests branch from 78f3938 to 8eabe3b Compare September 24, 2019 17:03
@rok

rok commented Sep 30, 2019

Copy link
Copy Markdown
Contributor Author

@glemaitre ping :)

@glemaitre
glemaitre merged commit 5e4b275 into scikit-learn:master Oct 1, 2019
@glemaitre

Copy link
Copy Markdown
Member

Thanks @rok

@rok

rok commented Oct 1, 2019

Copy link
Copy Markdown
Contributor Author

Thanks all! :)

davidgegiya added a commit to davidgegiya/agent-orchestrator that referenced this pull request Nov 9, 2026
Pin 21fc1d97452d4e3a6d744d0eef95ecaf7e87859c and its regression selectors for reproducible runs.

Source: scikit-learn/scikit-learn#13392
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing multi-output checks in common tests

6 participants