Skip to content

Revisit the "chance level" for the different displays #30352

Open

Description

@glemaitre

@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.

[1] Flach, P., & Kull, M. (2015). Precision-recall-gain curves: PR analysis done right. Advances in neural information processing systems, 28.

Activity

  1. added
    Needs Triage
    on Nov 26, 2024
  2. added and removed
    Needs Triage
    on Nov 26, 2024
  3. e-pet commented on Dec 1, 2024

    @e-pet

    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).
  4. ogrisel commented on Feb 10, 2025

    @ogrisel
    Member

    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").

  5. added
    good first issue
    on Jun 16, 2025
  6. EvMossan commented on Jun 19, 2025

    @EvMossan

    I’m taking this on and already have a working patch locally - will open a PR shortly.

  7. nithish-74 commented on Jul 20, 2025

    @nithish-74
  8. mdhvgoyal commented on Aug 11, 2025

    @mdhvgoyal

    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.

  9. Karthikeya-Thatipamula commented on Aug 15, 2025

    @Karthikeya-Thatipamula

    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?

  10. DHANUSHRAJA22 commented on Aug 26, 2025

    @DHANUSHRAJA22
  11. SrushtikShetty commented on Aug 27, 2025

    @SrushtikShetty

    I am taking it

  12. Yashp002 commented on Aug 29, 2025

    @Yashp002

    I'm taking it on

  13. removed
    good first issue
    on Sep 2, 2025
  14. lucyleeow commented on Sep 2, 2025

    @lucyleeow
    Member

    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?

  15. added 2 commits that reference this issue on Oct 6, 2025
    75680d1
    7798c4b
  16. e-pet commented on Oct 9, 2025

    @e-pet

    Hi all, thank you for continuing to work on this!

    A few thoughts from my side on the discussion:

    • "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':
      1. "F_1 score of always-positive classifier"
      2. "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.

  17. StefanieSenger commented on Oct 13, 2025

    @StefanieSenger
    Member

    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.

  18. moved this from Discussion to Needs decision in Visualization and displayson Oct 13, 2025
  19. moved this from Needs decision to Todo in Visualization and displayson Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions