scoringrules.vrgksuv_ensemble#
- scoringrules.vrgksuv_ensemble(obs: ArrayLike, fct: Array, a: float = -inf, b: float = inf, m_axis: int = -1, *, ens_w: Array = None, w_func: Callable[[ArrayLike], ArrayLike] = None, backend: Backend = None) Array#
Estimate the Vertically Re-scaled Gaussian Kernel Score (vrGKS) for a finite ensemble.
Computation is performed using the ensemble representation of vertically re-scaled kernel scores in [Allen et al. (2022)](https://arxiv.org/abs/2202.12732):
\[\mathrm{vrGKS}(F_{ens}, y) = - \frac{1}{M} \sum_{m = 1}^{M} k(x_{m}, y)w(x_{m})w(y) + \frac{1}{2 M^{2}} \sum_{m = 1}^{M} \sum_{j = 1}^{M} k(x_{m}, x_{j})w(x_{m})w(x_{j}) + \frac{1}{2} k(y, y)w(y)w(y),\]where \(F_{ens}(x) = \sum_{m=1}^{M} 1 \{ x_{m} \leq x \}/M\) is the empirical distribution function associated with an ensemble forecast \(x_{1}, \dots, x_{M}\) with \(M\) members, \(w\) is the chosen weight function, \(\bar{w} = \sum_{m=1}^{M}w(x_{m})/M\), and
\[k(x_{1}, x_{2}) = \exp \left(- \frac{(x_{1} - x_{2})^{2}}{2} \right)\]is the Gaussian kernel.
- Parameters:
- obsarray_like
The observed values.
- fctarray_like
The predicted forecast ensemble, where the ensemble dimension is by default represented by the last axis.
- afloat
The lower bound to be used in the default weight function that restricts attention to values in the range [a, b].
- bfloat
The upper bound to be used in the default weight function that restricts attention to values in the range [a, b].
- m_axisint
The axis corresponding to the ensemble. Default is the last axis.
- ens_warray
Weights assigned to the ensemble members. Array with the same shape as fct. Default is equal weighting. Weights are normalised so that they sum to one across the ensemble members.
- w_funccallable, array_like -> array_like
Weight function used to emphasise particular outcomes.
- backendstr
The name of the backend used for computations. Defaults to ‘numba’ if available, else ‘numpy’.
- Returns:
- scorearray_like
The vrGKS between the forecast ensemble and obs for the chosen weight function.
Examples
>>> import numpy as np >>> import scoringrules as sr >>> >>> def w_func(x): >>> return (x > -1).astype(float) >>> >>> sr.vrgksuv_ensemble(obs, pred, w_func=w_func)