scoringrules.gksuv_ensemble#
- scoringrules.gksuv_ensemble(obs: ArrayLike, fct: Array, m_axis: int = -1, *, ens_w: Array = None, estimator: str = 'nrg', backend: Backend = None) Array#
Compute the univariate Gaussian Kernel Score (GKS) for a finite ensemble.
The GKS is the kernel score associated with the Gaussian kernel
\[k(x_{1}, x_{2}) = \exp \left(- \frac{(x_{1} - x_{2})^{2}}{2} \right).\]Given an ensemble forecast \(F_{ens}\) comprised of members \(x_{1}, \dots, x_{M}\), the GKS is
\[\text{GKS}(F_{ens}, y)= - \frac{1}{M} \sum_{m=1}^{M} k(x_{m}, y) + \frac{1}{2 M^{2}} \sum_{m=1}^{M} \sum_{j=1}^{M} k(x_{m}, x_{j}) + \frac{1}{2}k(y, y)\]If the fair estimator is to be used, then \(M^{2}\) in the second component of the right-hand-side is replaced with \(M(M - 1)\).
- Parameters:
- obsarray_like
The observed values.
- fctarray_like
The predicted forecast ensemble, where the ensemble dimension is by default represented by the last axis.
- 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.
- estimatorstr
Indicates the estimator to be used.
- backendstr
The name of the backend used for computations. Defaults to ‘numba’ if available, else ‘numpy’.
- Returns:
- score:
The GKS between the forecast ensemble and obs.
Examples
>>> import scoringrules as sr >>> sr.gks_ensemble(obs, pred)