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

DEP deviance in favor of log_loss for GradientBoostingClassifier #23036

Merged
merged 10 commits into from
Apr 6, 2022

Conversation

lorentzenchr
Copy link
Member

Reference Issues/PRs

Partially addresses #18248

What does this implement/fix? Explain your changes.

This PR deprecates loss="deviance" in favor of loss="log_loss" in GradientBoostingClassifier. The default is changed accordingly.

Copy link
Member

@thomasjpfan thomasjpfan left a comment

Choose a reason for hiding this comment

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

Minor comments, otherwise LGTM.

doc/whats_new/v1.1.rst Outdated Show resolved Hide resolved
boosting recovers the AdaBoost algorithm.
loss : {'log_loss', 'exponential'}, default='log_loss'
The loss function to be optimized. 'log_loss' refers to binomial and
multinomial deviance, the same as used in linear logistic regression.
Copy link
Member

Choose a reason for hiding this comment

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

To be consistent with the docstring change above this one, can we remove the reference to "deviance"?

Suggested change
multinomial deviance, the same as used in linear logistic regression.
multinomial log loss, the same as used in logistic regression.

(Also I think most think of logistic regression as linear model.)

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm. How about calling them just binomial and multinomial log-likelihood?

Copy link
Member Author

Choose a reason for hiding this comment

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

"binomial" and "multinomial" are distributions, have a likelihood and, equivalently, a deviance. Log loss, although derivable from those likelihoods, is a loss that a priori has no distribution. I would speak of binary and multiclass log loss.

doc/whats_new/v1.1.rst Outdated Show resolved Hide resolved
deviance (= logistic regression) for classification
with probabilistic outputs. For loss 'exponential' gradient
boosting recovers the AdaBoost algorithm.
loss : {'log_loss', 'exponential'}, default='log_loss'
Copy link
Member

Choose a reason for hiding this comment

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

During the deprecation, "deviance" is still valid and should stay in the set of valid losses

Copy link
Member Author

Choose a reason for hiding this comment

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

I have seen both. E.g. the deprecation of the "mae" and "mse" criterion in trees are also not listed anymore during the deprecation cycle. They are only listed under deprecated.
I personally prefer it this way, but will do as reviewers wish.

Copy link
Member

Choose a reason for hiding this comment

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

There's also the default value that is directly changed. The thing is that it's just a renaming that gives the same model, so maybe it's acceptable. I'm not sure if it can be a problem ?

Copy link
Member

@jeremiedbb jeremiedbb Apr 4, 2022

Choose a reason for hiding this comment

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

I personally prefer it this way, but will do as reviewers wish.

I don't have a strong opinion, but I'd like that we always do it the same way (I didn't remember that we did it this way in the trees). Maybe we should explain how to update the doc in the contributing guide.

Copy link
Member Author

Choose a reason for hiding this comment

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

#19310 kept "mae" and "mse", but #21314 removed them before the end of the cycle.

don't have a strong opinion

Me neither. If I have a wish, then to get over it fast 😉

Copy link
Member Author

Choose a reason for hiding this comment

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

So I re-introduce them.

Copy link
Member

@jeremiedbb jeremiedbb left a comment

Choose a reason for hiding this comment

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

LGTM.

There's just one thing I'm not sure about. Here the default changes from "deviance" to "log_loss" immediately. Usually when we rename, we make the change effective at the end of the cycle. Here it should be fine since both are equivalent so I think we can safely move forward, but maybe I'm missing something ?

doc/whats_new/v1.1.rst Outdated Show resolved Hide resolved
sklearn/ensemble/_gb.py Outdated Show resolved Hide resolved
Copy link
Member

@glemaitre glemaitre left a comment

Choose a reason for hiding this comment

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

LGTM as well.

sklearn/ensemble/_gb.py Outdated Show resolved Hide resolved
@jeremiedbb jeremiedbb merged commit 2d97ef8 into scikit-learn:main Apr 6, 2022
@lorentzenchr
Copy link
Member Author

@jeremiedbb Thanks for finishing.

@lorentzenchr lorentzenchr deleted the call_it_log_loss_gb branch April 6, 2022 18:57
jjerphan pushed a commit to jjerphan/scikit-learn that referenced this pull request Apr 29, 2022
…kit-learn#23036)

Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants