scoringrules.crps_quantile#
- scoringrules.crps_quantile(obs: ArrayLike, fct: Array, alpha: Array, m_axis: int = -1, *, backend: Backend = None) Array#
Approximate the CRPS from quantile predictions via the Pinball Loss.
It is based on the notation in [1].
The CRPS can be approximated as the mean pinball loss for all quantile forecasts \(F_q\) with level \(q \in Q\):
\[\text{quantileCRPS} = \frac{2}{|Q|} \sum_{q \in Q} PB_q\]where the pinball loss is defined as:
\[\begin{split}\text{PB}_q = \begin{cases} q(y - F_q) &\text{if} & y \geq F_q \\ (1-q)(F_q - y) &\text{else.} & \\ \end{cases}\end{split}\]- Parameters:
- obsarray_like
The observed values.
- fctarray_like
The predicted forecast ensemble, where the ensemble dimension is by default represented by the last axis.
- alphaarray_like
The percentile levels. We expect the quantile array to match the axis (see below) of the forecast array.
- m_axisint
The axis corresponding to the ensemble. Default is the last axis.
- backendstr, optional
The name of the backend used for computations. Defaults to
numbaif available, elsenumpy.
- Returns:
- qcrpsarray_like
An array of CRPS scores for each forecast, which should be averaged to get meaningful values.
References
[1]Berrisch, J., & Ziel, F. (2023). CRPS learning. Journal of Econometrics, 237(2), 105221. Available at https://arxiv.org/abs/2102.00968.
# TODO: add example