You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Revisit the "chance level" for the different displays #30352
@e-pet commented on different PRs & issues some interesting fact. I take the opportunity to consolidate some of those comments here.
First, we use the term "chance" that is ambiguous depending of the displays. The term "baseline" would probably be better. In addition, I checked and I think we should make an extra effort on the definition of the baseline for each of the type of plot: for ROC curve, the baseline is "a random classifier assigning the positive class with probability p and the negative class with probability 1 − p" [1] while for the PR curve, the baseline is derived from the "always-positive classifier" where any recall or precision under π should be discarded [1].
It leads to a second where in the PR curve, we plot the horizontal line derived from the always-positive classifier but we don't discard when recall < π. In this case, as mentioned by @e-pet, it might make sense to show the hyperbolic line of the always-positive classifier instead (cf. Fig. 2 in [1]).
@e-pet feel free to add any other points that you wanted to discuss. Here, I wanted to focus on the one that looks critical and could be addressed.
Hi @glemaitre, thank you for collecting this here!
I did some further reading in the meantime (and fixed at least one misunderstanding of mine), so let me try to summarize the issue(s).
My dismissal of the horizontal line derived from the always-positive classifier was wrong. One can construct it this way: have a "model" return completely random scores, and then tune the decision threshold between 0 and 1. This yields exactly that horizontal line. So: the horizontal line is valid (=associated with actual baseline models one can easily construct at every point along the line), and it is actually based on a 'chance' baseline. (Might be worth pointing this out somewhere in the documentation, if this is not already the case?)
Separately from this, Flach and Kull argue that in terms of the area under the PR curve, the baseline to beat is a curve that has $F_1$ score equaling that of the always-positive classifier at every point along the curve. The interpretation is simple: if your model is below this line, you perform worse than a trivial always-positive classifier in terms of $F_1$. This is where the hyperbolic baseline comes from. I am actually not sure what the equivalent curve in the ROC case would be, or whether it differs from the standard diagonal? Note that at least to my current understanding, this baseline is 'virtual' in the sense that it is not trivially possible to actually construct models with the precision / recall values specified by every point along the curve.
To complicate matters further, there is actually a third 'baseline-like' line that one could show: this is the unreachable region in PR space, described here (and also very easy to calculate). Points below this line cannot be reached by any classifier (with important consequences for the validity of naive AUCPR comparisons, as spelled out both in this paper and the Flach/Kull paper).
For the ROC curve, what we currently call "chance level" (the diagonal ROC curve) is any non-informative baseline/predictor: a predictor whose predictions do not depend on X. They can be any constant predict_proba predictions: 0, 1, the fraction of the majority class in the training set or any arbitrary constant prediction. Or even a classifier that outputs a random predicted probability at each test point would also have a ROC Curve lying on the diagonal in the limit of a large prediction set.
Personally, I don't like the "chance-level" naming because it is a bit fuzzy, and it's not intuitive how a classifier that constantly predicts 1 or 0 can be related to "chance". I would rather name this "non-informative predictor" or "non-informative baseline" (or event "constant predictor").
Hey, I'd like to work on this. I have a fix ready where I've updated the label to "Non-informative baseline" in RocCurveDisplay. I will be creating a Pull Request shortly.
Hi @glemaitre,
I’d like to work on this issue — updating “chance level” to “non-informative baseline” and improving baseline handling/documentation in the ROC & PR displays.
I’ve read the Flach & Kull paper and reviewed the display code, so I’m ready to start right away.
Could you please assign this to me?
I've removed the good first issue tag as judging by the 4 PRs which all address this issue in a different way, I don't think we have reached consensus on how best to address this issue.
I think we agree that 'chance' is not an ideal term. @glemaitre has suggested "baseline" while @ogrisel has suggested "non-informative predictor" or "non-informative baseline" (or event "constant predictor"). I think it would be nice if the ROC curve and PR curve "chance"/"baseline"/"non-informative"... lines both had names that were somewhat consistent. Let's get consensus on what to change it to before we start.
@e-pet (#30352 (comment)) do you think we should re-think which 'baseline' line we include in our PR curve? Or if we should include more than one? Or that we should mention the others in documentation?
"Chance" vs. "Non-informative": I like the former because it is "constructive" in the sense that it also tells the reader how exactly that baseline can actually be obtained. But I also get @ogrisel on the fact that other non-informative baselines (eg constant predictors) yield the same line. So maybe "Non-informative" + some elaboration on this in the docs would be the best solution?
For the PR curve, I would personally advocate for the possibility to optionally also display the two other 'baselines':
"F_1 score of always-positive classifier"
"Unreachable region" - this would ideally be not just a line but some kind of shading of the region below it
I would actually prefer to show all relevant baselines by default, but my understanding was that this is unwanted because of backwards stability.
Going forward, the first things we need to decide on would be (1) how we provide the user with a non-informative/baseline/chance-level plot and (2) what to call it.
So, maybe we can add something like plot_baseline=False param to Display.plot(), that will plot a baseline (or several?) in an unremarkable colour (light grey?) when set to True. This preserves backwards compatibility (because the default behaviour of the display is unchanged) and if we want to change this some time in the future, we can.
Regarding the name it seems to consolidate around "Non-informative", which could also be part of a param description. I personally think that "baseline" alone can be misinterpreted (it's unclear that it stems from random data, rather than depending on the provided data trained in some model) and it should show better in the param name. Such as plot_chance_level, plot_random_baseline or plot_non_informative_baseline 😅. In any case, I strongly agree on telling users on how the baseline(s) would be constructed in the docs.
How the non-informative baseline would be calculated and whether there should be many, can be discussed per Display. Once we have agreed on (1) and (2), this issue could become a meta-issue and we open sub-issues per display.
Activity
e-pet commentedon Dec 1, 2024
Hi @glemaitre, thank you for collecting this here!
I did some further reading in the meantime (and fixed at least one misunderstanding of mine), so let me try to summarize the issue(s).
ogrisel commentedon Feb 10, 2025
For the ROC curve, what we currently call "chance level" (the diagonal ROC curve) is any non-informative baseline/predictor: a predictor whose predictions do not depend on X. They can be any constant predict_proba predictions: 0, 1, the fraction of the majority class in the training set or any arbitrary constant prediction. Or even a classifier that outputs a random predicted probability at each test point would also have a ROC Curve lying on the diagonal in the limit of a large prediction set.
Personally, I don't like the "chance-level" naming because it is a bit fuzzy, and it's not intuitive how a classifier that constantly predicts 1 or 0 can be related to "chance". I would rather name this "non-informative predictor" or "non-informative baseline" (or event "constant predictor").
EvMossan commentedon Jun 19, 2025
I’m taking this on and already have a working patch locally - will open a PR shortly.
nithish-74 commentedon Jul 20, 2025
mdhvgoyal commentedon Aug 11, 2025
Hey, I'd like to work on this. I have a fix ready where I've updated the label to "Non-informative baseline" in RocCurveDisplay. I will be creating a Pull Request shortly.
Karthikeya-Thatipamula commentedon Aug 15, 2025
Hi @glemaitre,
I’d like to work on this issue — updating “chance level” to “non-informative baseline” and improving baseline handling/documentation in the ROC & PR displays.
I’ve read the Flach & Kull paper and reviewed the display code, so I’m ready to start right away.
Could you please assign this to me?
DHANUSHRAJA22 commentedon Aug 26, 2025
SrushtikShetty commentedon Aug 27, 2025
I am taking it
Yashp002 commentedon Aug 29, 2025
I'm taking it on
lucyleeow commentedon Sep 2, 2025
I've removed the good first issue tag as judging by the 4 PRs which all address this issue in a different way, I don't think we have reached consensus on how best to address this issue.
I think we agree that 'chance' is not an ideal term.
@glemaitre has suggested "baseline" while @ogrisel has suggested "non-informative predictor" or "non-informative baseline" (or event "constant predictor"). I think it would be nice if the ROC curve and PR curve "chance"/"baseline"/"non-informative"... lines both had names that were somewhat consistent. Let's get consensus on what to change it to before we start.
@e-pet (#30352 (comment)) do you think we should re-think which 'baseline' line we include in our PR curve? Or if we should include more than one? Or that we should mention the others in documentation?
DOC: clarify 'baseline' (formerly 'chance') wording for PR display an…
DOC: clarify 'baseline' (formerly 'chance') wording for PR display an…
e-pet commentedon Oct 9, 2025
Hi all, thank you for continuing to work on this!
A few thoughts from my side on the discussion:
I would actually prefer to show all relevant baselines by default, but my understanding was that this is unwanted because of backwards stability.
StefanieSenger commentedon Oct 13, 2025
Going forward, the first things we need to decide on would be (1) how we provide the user with a non-informative/baseline/chance-level plot and (2) what to call it.
So, maybe we can add something like
plot_baseline=Falseparam toDisplay.plot(), that will plot a baseline (or several?) in an unremarkable colour (light grey?) when set toTrue. This preserves backwards compatibility (because the default behaviour of the display is unchanged) and if we want to change this some time in the future, we can.Regarding the name it seems to consolidate around "Non-informative", which could also be part of a param description. I personally think that "baseline" alone can be misinterpreted (it's unclear that it stems from random data, rather than depending on the provided data trained in some model) and it should show better in the param name. Such as
plot_chance_level,plot_random_baselineorplot_non_informative_baseline😅. In any case, I strongly agree on telling users on how the baseline(s) would be constructed in the docs.How the non-informative baseline would be calculated and whether there should be many, can be discussed per Display. Once we have agreed on (1) and (2), this issue could become a meta-issue and we open sub-issues per display.