Skip to content

Metrics for prediction intervals #20162

Open

Description

@ThomasBourgeois

Yesterday, I had a dream where scikit learn has implemented main metrics for prediction intervals.

A review of typical metrics for prediction intervals can be found on this publication (p.16 to 17): 'Review of Deterministic and Probabilistic Wind Power Forecasting: Models, Methods, and Future Research' (https://www.mdpi.com/2673-4826/2/1/2)

Typically : with the lower bound and the upper bound

  • PICP (Prediction Interval Coverage Probability)
    image
    with
    image
    PICP is maybe not so useful in itself, but needed to calculate the ACE below, which is really the critical metric.

  • PINC (Prediction Interval Nominal Coverage) : the nominal level of uncertainty, e.g. 90% if the quantiles you predict are 5% and 95%
    PINC is somewhat a necessary preliminary definition for computing the ACE below.

  • ACE (Average Coverage Error)
    image
    That metric is really the critical one that really feels missing the most. It represents how much the interval can be trusted, because, for example, when we say that we compute the 90 % confidence interval, we want that close to 90% of the test points rely in that interval. For this reason we usually refer to that metric as measuring the reliability of the interval.

  • PINAW (Prediction Interval Normalized Average Width)
    image
    That is the second critical metric that would need be implemented. It measures the sharpness of the interval. This is a very complementary thing to the ACE, as it measures how wide the interval is. Indeed, useful intervals are the one that are reliable of course, but that are also narrow. The ACE does not mesure how narrow/sharp we are, this needs to be measured by the PINAW (or interval score, see below)

  • CWC (Coverage Width Criterion)
    image
    with
    image
    usually equals the PINC and is a penalty coefficient
    That metric I have put here for reference because it is cited in the article. For the moment I personnaly have not used it as it combines the ACE and PINAW, but in a way that still needs to be clarified (to me at least, before I would chose to use it).

  • Interval Score (This metric does not come from the same publication as the others, this one comes from Wan, C., Xu, Z., Pinson, P., Dong, Z. Y., & Wong, K. P. (2014). Probabilistic forecasting of wind power generation using extreme learning machine. IEEE Transactions on Power Systems, 29(3). https://doi.org/10.1109/TPWRS.2013.2287871)
    image
    With
    image defining the width of the PI.
    That is probably the third metric I would find very interesting to add. The reason for this is that the interval score adds to the ACE and PINAW the consideration of how far is the prediction from the interval when it is not in the interval, which can permit to discriminate between two models where predictions would be out of the interval, but the prediction of one model would be closer to the interval's boundary than the prediction of the other model.

Currently sklearn permits to calculate such prediction intervals, typically with GradientBoostingRegressor and quantile loss, but the classic way to calculate the validity of these intervals cannot be done through sklearn as smoothly as for deterministic forecast with MSE, MAE, etc. Implementing several of these metrics would close the gap.

Activity

  1. lorentzenchr commented on Jun 19, 2021

    @lorentzenchr
    Member

    @ThomasBourgeois Dreams are allowed. Sharing them even more so.
    If you calculate quantiles, you can use mean_pinball_loss with the upcoming v1.0 to assess them or compare several models predicting them.
    For assessing (marginal) calibration (what you might call coverage in this context), there is no metric available that I‘m aware of. (But they are easy to implement.)

  2. ThomasBourgeois commented on Jun 19, 2021

    @ThomasBourgeois
    Author

    HI @lorentzenchr thanks for your answer !
    The pinball loss clearly is one of them, also very useful to fit algorithms like gradientboostingregressor, amongst others.

    However the other metrics i showed above and that I just updated with their formula provide very useful additional information : for example the ACE should be very close to 0 on a test set, for the quantiles to be "correct", that is that the 5% and 95% quantiles cover really 90% of the test points.
    The ACE usually is refered to "reliability" of the quantiles, that is, how much they really cover what they are expected to.

    On the other hand, the PINAW, represents a very different thing, which is the width of the prediction intervals, and is usually referred to as a measure of "sharpness" of the prediction intervals. The lower the PINAW, the better the prediction intervals. For example, it is very easy to have an ACE close to zero, by taking the train distribution to make dummy quantiles, however, those have a very poor PINAW, as they are very wide.

    Of course, as you mentioned, these are very easy to implement, but that could be said true also for the MAE, MSE, etc. and they're included in sklearn :)

  3. lorentzenchr commented on Jul 4, 2021

    @lorentzenchr
    Member

    If you sum up the two corresponding pinball losses for alpha/2 quantile l, 1-alpha/2 quantile u and observation y, you get, see Gneiting & Raftery Eq. (43): (u - l) + 2/alpha (l-y) 1_{y<l} + 2/alpha (y - u) 1_{u<y}. This penalizes wider intervals and is strictly consistent scoring function for this symmetric interval.

  4. ThomasBourgeois commented on Jul 5, 2021

    @ThomasBourgeois
    Author

    (largely edited answer, sorry for the original one, where I missed your point)
    Your equation is actually just a linear factor away from the interval score mentionned in the original issue above. (Multiplying by 2 alpha your equation above and averaging over the whole dataset gives exactly the interval score mentionned in the original issue above)
    However, I still think it would be a lot more convenient for users to have a defined metric calculating the interval score rather than having to take the the pinball loss for alpha/2, then for 1-alpha/2, then sum up the two and finally average over the test set. That does not feel very user friendly for such a useful metric.
    Also, that metric does not measure the reliability measured by the ACE, which is very different from the sharpness that you measure with either the PINAW or interval score. So my feeling is we are really missing some useful metrics here.

  5. ThomasBourgeois commented on Nov 18, 2021

    @ThomasBourgeois
    Author

    @glemaitre the issue I talked to you about today in person. I think it could be a nice add-on.
    My go-to for the useful metrics to implement would be :

    • PICP, useful because it is needed to calculate ACE
    • ACE : to measure the reliability of interval scores
    • PINAW : to measure the sharpness of interval scores
    • Interval score : as mentionned in the original issue above, it provides additionnal information on top of what offers the ACE and the PINAW (how far is one model's prediction from the interval boundary, when it is out of the interval)
  6. rmanak commented on Oct 6, 2022

    @rmanak

    +1 to this (I may be able to open a PR for it if I feel inspired) Thomas, please note that in ACE, the "Average" needs to be performed across multiples levels of the prediction intervals, aka CE is PICP - PINC then in literature often ACE is defined as average of the absolute value of this error across multiple PIs such as [45,55] [40, 60], [35,65] ... [5,95]. For example see eq ACE on page 4 here: https://arxiv.org/pdf/1909.12122.pdf

  7. ThomasBourgeois commented on Jan 25, 2023

    @ThomasBourgeois
    Author

    +1 to this (I may be able to open a PR for it if I feel inspired) Thomas, please note that in ACE, the "Average" needs to be performed across multiples levels of the prediction intervals, aka CE is PICP - PINC then in literature often ACE is defined as average of the absolute value of this error across multiple PIs such as [45,55] [40, 60], [35,65] ... [5,95]. For example see eq ACE on page 4 here: https://arxiv.org/pdf/1909.12122.pdf

    Happy that you find that issue useful too.
    About your proposed correction, interestingly enough there seems to be two close definitions for ACE :

    • one where we do not average over all levels, in that sense, average is to be understood over all test samples, e.g. (1-2)
    • one where we do, in that sense average is to be understood over all levels : e.g. (3-4)

    Probably we should dig in more.For the moment I would trust more (1), because of the authors in question and the journal name. Also, (3) and (4) are the same authors. But maybe I'm wrong and we would need more articles to confirm.

    [1] Wan, C., Xu, Z., Pinson, P., Dong, Z. Y., & Wong, K. P. (2014). Probabilistic forecasting of wind power generation using extreme learning machine. IEEE Transactions on Power Systems, 29(3). https://doi.org/10.1109/TPWRS.2013.2287871
    [2] Bazionis, I. K., Georgilakis, P. S., (2021) Review of Deterministic and Probabilistic Wind Power Forecasting: Models, Methods, and Future Research
    [3] Hatalis, K, Lamadrid, A. J., Scheinberg, K., Kishore, S. (2017) Smooth Pinball Neural Network for Probabilistic Forecasting of Wind Power
    [4] Hatalis, K, Lamadrid, A. J., Scheinberg, K., Kishore, S. (2019) A Novel Smoothed Loss and Penalty Function for Noncrossing Composite Quantile Estimation via Deep Neural Networks

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

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions