Skip to content
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

[MRG] Fixed gradient computation in gradient boosting for multiclass classification #12715

Merged

Conversation

NicolasHug
Copy link
Member

Reference Issues/PRs

Fixes #12696

What does this implement/fix? Explain your changes.

The gradients should be evaluated at iteration i - 1, that is, using the values of y_pred at iteration i - 1

In the current implementation, y_pred is partially updated during the loop over the K trees of the current iteration. This means that the gradients aren't evaluated at iteration i - 1 anymore. It's a mix between iteration i - 1 and iteration i.

The current fix copies y_pred before looping over the trees to avoid this.

I'm not sure how to propose a non-regression test for this.

Any other comments?

Copy link
Contributor

@eamanu eamanu left a comment

Choose a reason for hiding this comment

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

LGTM

@ogrisel
Copy link
Member

ogrisel commented Dec 7, 2018

Indeed this PR seems to fix a bug, however it's probably not easy to write a non-regression test as the effect is probably very subtle.

Copy link
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.

Worth throwing into 0.20.X?

@NicolasHug
Copy link
Member Author

It's hard to tell how strong the impact of the changes would be... My gut feeling is that it would be pretty minimal.

@ogrisel
Copy link
Member

ogrisel commented Dec 14, 2018

I think nobody will notice the bug in practice. Not worth the backport a priori. But @jnothman feel free to do the backport if you disagree.

@adrinjalali adrinjalali merged commit e73acef into scikit-learn:master Dec 19, 2018
@adrinjalali
Copy link
Member

Thanks @NicolasHug

adrinjalali pushed a commit to adrinjalali/scikit-learn that referenced this pull request Jan 7, 2019
…assification (scikit-learn#12715)

* Fixed gradient update

* Added whatsnew entry
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
…assification (scikit-learn#12715)

* Fixed gradient update

* Added whatsnew entry
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
koenvandevelde pushed a commit to koenvandevelde/scikit-learn that referenced this pull request Jul 12, 2019
…assification (scikit-learn#12715)

* Fixed gradient update

* Added whatsnew entry
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.

Incorrect gradient computation in Gradient Boosting for multiclass classification
5 participants