scoringrules.crps_exponential#
- scoringrules.crps_exponential(obs: ArrayLike, rate: ArrayLike, *, backend: Backend = None) ArrayLike#
Compute the closed form of the CRPS for the exponential distribution.
It is based on the following formulation from [1]:
\[\mathrm{CRPS}(F_{\lambda}, y) = |y| - \frac{2F_{\lambda}(y)}{\lambda} + \frac{1}{2 \lambda},\]where \(F_{\lambda}\) is exponential distribution function with rate parameter \(\lambda > 0\).
- Parameters:
- obsarray_like
The observed values.
- ratearray_like
Rate parameter of the forecast exponential distribution.
- backendstr, optional
The name of the backend used for computations. Defaults to
numbaif available, elsenumpy.
- Returns:
- crps:
The CRPS between Exp(rate) and obs.
References
[1]Jordan, A., Krüger, F., & Lerch, S. (2019). Evaluating Probabilistic Forecasts with scoringRules. Journal of Statistical Software, 90(12), 1-37. https://doi.org/10.18637/jss.v090.i12
Examples
>>> import scoringrules as sr >>> import numpy as np >>> sr.crps_exponential(0.8, 3.0) 0.360478635526275 >>> sr.crps_exponential(np.array([0.8, 0.9]), np.array([3.0, 2.0])) array([0.36047864, 0.31529889])