Skip to content

[MRG+1] API Change default multioutput in RegressorMixin.score to keep consistent with metrics.r2_score#13157

Merged
qinhanmin2014 merged 11 commits intoscikit-learn:masterfrom
qinhanmin2014:RegressorMixin
Mar 15, 2019
Merged

[MRG+1] API Change default multioutput in RegressorMixin.score to keep consistent with metrics.r2_score#13157
qinhanmin2014 merged 11 commits intoscikit-learn:masterfrom
qinhanmin2014:RegressorMixin

Conversation

@qinhanmin2014
Copy link
Copy Markdown
Member

Closes #12772
Wondering if someone has a better way :)
In the original issue, I tried to ask why we prefer uniform_average, but received no reply. I guess we choose uniform_average to keep consistent with other regression metrics.

@qinhanmin2014 qinhanmin2014 added this to the 0.21 milestone Feb 13, 2019
@jnothman
Copy link
Copy Markdown
Member

jnothman commented Feb 13, 2019 via email

@qinhanmin2014
Copy link
Copy Markdown
Member Author

An alternative might be too require multioutput to be explicit specified in r2_score

You mean adding a multioutput parameter in RegressorMixin.score. Does this violate our API design?

@jnothman
Copy link
Copy Markdown
Member

No, I mean that r2_score would no longer accept being called on multioutput without an explicit choice.

@qinhanmin2014
Copy link
Copy Markdown
Member Author

No, I mean that r2_score would no longer accept being called on multioutput without an explicit choice.

You mean we'll raise an error for things like r2_score(y_true, y_pred) when y_type is continuous-multioutput? I doubt whether it's a good idea and it's not related to this PR, right?
(1) If we do so, we'll need to update other regression metrics
(2) If we do so, we'll need to intruduce a multioutput parameter in RegressorMixin.score

@jnothman
Copy link
Copy Markdown
Member

jnothman commented Feb 14, 2019 via email

@qinhanmin2014
Copy link
Copy Markdown
Member Author

Well, it solves this problem since users of r2_score would become aware that the equivalence to .score cannot be taken for granted...?

So with your proposal:
(1) We'll need to update other regression metrics.
(2) Users can't use RegressorMixin.score to evaluate multioutput problems?

And this is not backward compatible, I doubt whether it's worthwhile.

@qinhanmin2014
Copy link
Copy Markdown
Member Author

(2) Users can't use RegressorMixin.score to evaluate multioutput problems?

Maybe you mean that we should set multioutput explicitly in RegressorMixin.score?

@jnothman
Copy link
Copy Markdown
Member

jnothman commented Feb 14, 2019 via email

@qinhanmin2014
Copy link
Copy Markdown
Member Author

We already do that??? But we don't document it...

But this is actually a bug introduced in #5143 right?

I still doubt whether it's worthwhile to let all the regression metrics which supports multioutput to raise an error when parameter multioutput is not set explicitly (y_type is multioutput). Is this your final decision?

@jnothman
Copy link
Copy Markdown
Member

jnothman commented Feb 14, 2019 via email

@qinhanmin2014
Copy link
Copy Markdown
Member Author

No I suppose it doesn't really solve the problem... Documentation does.

@jnothman Could you please summarize your proposal here? I'm starting to get confused. Thanks.

@qinhanmin2014
Copy link
Copy Markdown
Member Author

I'm surprised to find that we implement the score method in MultiOutputRegressor and are using multioutput='uniform_average' there :)
I prefer to include this is 0.21. @jnothman Is it possible to regard it as a bug fix and change it without a deprecation cycle? If not, what's your proposal here?

@jnothman
Copy link
Copy Markdown
Member

Can we stay by documenting the current behaviour?

@jnothman jnothman closed this Mar 12, 2019
@jnothman jnothman reopened this Mar 12, 2019
@qinhanmin2014
Copy link
Copy Markdown
Member Author

@jnothman current behavior:
(1)r2_score default multioutput="uniform_average"
(2)MultiOutputRegressor default multioutput="uniform_average"
(3)RegressorMixin (i.e., all other regressors) default multioutput="variance_weighted"
Do you think that's acceptable? (without (2), maybe acceptable)
I think we can regard it as a bug fix because it's erroneously introduced when changing the default value of a parameter.

Copy link
Copy Markdown
Member

@jnothman jnothman left a comment

Choose a reason for hiding this comment

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

Okay. I'm persuaded. I think this is an okay solution, albeit raising lots of warnings for the next while.

@qinhanmin2014
Copy link
Copy Markdown
Member Author

ready for review @jnothman

@qinhanmin2014
Copy link
Copy Markdown
Member Author

ping related people here: @amueller @agramfort @ogrisel
and maybe @adrinjalali

@agramfort agramfort changed the title API Change default multioutput in RegressorMixin.score to keep consistent with metrics.r2_score [MRG+1] API Change default multioutput in RegressorMixin.score to keep consistent with metrics.r2_score Mar 15, 2019
@qinhanmin2014 qinhanmin2014 merged commit 73e2ecf into scikit-learn:master Mar 15, 2019
@qinhanmin2014 qinhanmin2014 deleted the RegressorMixin branch March 17, 2019 03:22
@amueller
Copy link
Copy Markdown
Member

Thanks! Maybe we should tell the user how to avoid this message? It's a bit ugly unfortunately. They can specify it directly when using cv or grid-search.
If they use the score method they would need to import r2 directly.

@qinhanmin2014
Copy link
Copy Markdown
Member Author

Thanks! Maybe we should tell the user how to avoid this message? It's a bit ugly unfortunately. They can specify it directly when using cv or grid-search. If they use the score method they would need to import r2 directly.

I've opened #13477 @amueller

xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
…p consistent with metrics.r2_score (scikit-learn#13157)"

This reverts commit 587fcf5.
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
…p consistent with metrics.r2_score (scikit-learn#13157)"

This reverts commit 587fcf5.
koenvandevelde pushed a commit to koenvandevelde/scikit-learn that referenced this pull request Jul 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants