8000 Documentation section 3.3.1.1 has incorrect description of brier_score_loss · Issue #13887 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content
8000

Documentation section 3.3.1.1 has incorrect description of brier_score_loss #13887

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

Closed
Sycor4x opened this issue May 15, 2019 · 9 comments · Fixed by #14898
Closed

Documentation section 3.3.1.1 has incorrect description of brier_score_loss #13887

Sycor4x opened this issue May 15, 2019 · 9 comments · Fixed by #14898
Labels
Bug Easy Well-defined and straightforward way to resolve good first issue Easy with clear instructions to resolve
Milestone

Comments

@Sycor4x
Copy link
Sycor4x commented May 15, 2019

In the documentation, section 3.3.1.1. "Common cases: predefined values" includes the remark

All scorer objects follow the convention that higher return values are better than lower return values.

As far as I can tell, this is true for all of the listed metrics, except the brier_score_loss. In the case of brier_score_loss, a lower loss value is better. This is because brier_score_loss measures the mean-square difference between a predicted probability and a categorical outcome; the Brier score is minimized at 0.0 because all summands are either (0 - 0) ^ 2=0 or (1 -1) ^ 2=0 when the model is making perfect predictions. On the other hand, the Brier score is maximized at 1.0 when all predictions are opposite the correct label, as all summands are either (0 - 1)^2=1 or (1 - 0)^2=1.

Therefore, the definition of the brier_score_loss is not consistent with the quotation from section 3.3.1.1.

I suggest making 2 changes to relieve this confusion.

  1. Implement a function neg_brier_score_loss which simply negates the value of brier_score_loss; this is a direct analogy to what is done in the case of neg_log_loss. A better model has a lower value of log-loss (categorical cross-entropy loss), therefore a larger value of the negative log-loss implies a better model. Naturally, the same is true for Brier score, where it is also the case that a better model is assigned a lower loss.

  2. Remove reference to brier_score_loss from section 3.3.1.1. Brier score is useful in lots of ways; however, because it does not have the property that a larger value implies a better model, it seems confusing to mention it in the context of section 3.3.1.1. References to brier_score_loss can be replaced with neg_brier_score_loss, which has the property that better models have large values, just like accuracy, ROC AUC and the rest of the listed metrics.

@ogrisel
Copy link
Member
ogrisel commented May 16, 2019

Indeed this is probably the right course of action. Please feel free to open a PR if your wish.

@qdeffense
Copy link
Contributor

@Sycor4x I'll gladly work on it if you're not already doing it

@Sycor4x
Copy link
Author
Sycor4x commented May 17, 2019

@qdeffense Thank you. I had planned to start these revisions if this suggestion were well-received; however, I've just come down with a cold and won't be able to write coherent code at the moment. If you want to take a stab at this, I support your diligence.

It occurred to me after I wrote this that it is possible for the verbal description in 3.3.1.1 to be incorrect while the behavior of the scorer objects called via the strings in 3.3.1.1 might work correctly in the sense that internally, brier_score_loss behaves in the same manner as neg_log_loss and therefore is consistent with the statement

All scorer objects follow the convention that higher return values are better than lower return values.

If this is the case, then the documentation is the only thing that needs to be tweaked: just make it explicit that some kind of reversal is applied to brier_score_loss such that the block quote is true.

I haven't been able to check -- I'm basically incapacitated right now.

@jnothman
Copy link
Member

No, we should be using neg_brier_loss or something. We made a similar change for other losses in 7e079c0fd2^...2ba3478.

@qinhanmin2014
Copy link
Member

Apologies the mistake was introduced by me.
I agree that we should introduce neg_brier_score_loss and deprecate brier_score_loss.

@qinhanmin2014 qinhanmin2014 added this to the 0.22 milestone May 21, 2019
@qinhanmin2014 qinhanmin2014 added Bug Easy Well-defined and straightforward way to resolve good first issue Easy with clear instructions to resolve help wanted labels Jun 13, 2019
@stefan-matcovici
Copy link
Contributor

Hi! I would want to start working on this.

@jnothman
Copy link
Member

Thanks @stefan-matcovici

@nityamd
Copy link
Contributor
nityamd commented Aug 24, 2019

I'll work on this.

@amueller
Copy link
Member

@nityamd I think @stefan-matcovici is working on that already in #14123.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
0