scoringrules.vs_ensemble

Contents

scoringrules.vs_ensemble#

scoringrules.vs_ensemble(obs: Array, fct: Array, w: Array = None, m_axis: int = -2, v_axis: int = -1, *, ens_w: Array = None, p: float = 0.5, estimator: str = 'nrg', backend: Backend = None) Array#

Compute the Variogram Score for a finite multivariate ensemble.

For a \(D\)-variate ensemble the Variogram Score [1] is defined as:

\[\text{VS}_{p}(F_{ens}, \mathbf{y})= \sum_{i=1}^{d} \sum_{j=1}^{d} w_{i,j} \left( \frac{1}{M} \sum_{m=1}^{M} | x_{m,i} - x_{m,j} |^{p} - | y_{i} - y_{j} |^{p} \right)^{2},\]

where \(\mathbf{X}\) and \(\mathbf{X'}\) are independently sampled ensembles from from \(F\).

Parameters:
obsarray_like

The observed values, where the variables dimension is by default the last axis.

fctarray_like

The predicted forecast ensemble, where the ensemble dimension is by default represented by the second last axis and the variables dimension by the last axis.

warray_like

The weights assigned to pairs of dimensions. Must be of shape (…, D, D), where D is the dimension, so that the weights are in the last two axes.

m_axisint

The axis corresponding to the ensemble dimension. Defaults to -2.

v_axisint

The axis corresponding to the variables dimension. Defaults to -1.

ens_warray_like

Weights assigned to the ensemble members. Array with one less dimension than fct (without the v_axis dimension). Default is equal weighting. Weights are normalised so that they sum to one across the ensemble members.

pfloat

The order of the Variogram Score. Typical values are 0.5, 1.0 or 2.0. Defaults to 0.5.

estimatorstr

The variogram score estimator to be used.

backend: str

The name of the backend used for computations. Defaults to ‘numba’ if available, else ‘numpy’.

Returns:
vs_ensemblearray_like

The computed Variogram Score.

References

[1]

Scheuerer, M., and T. M. Hamill (2015), Variogram-Based Proper Scoring Rules for Probabilistic Forecasts of Multivariate Quantities. Mon. Wea. Rev., 143, 1321-1334, https://doi.org/10.1175/MWR-D-14-00269.1.

Examples

>>> import numpy as np
>>> import scoringrules as sr
>>> rng = np.random.default_rng(123)
>>> obs = rng.normal(size=(3, 5))
>>> fct = rng.normal(size=(3, 10, 5))
>>> sr.vs_ensemble(obs, fct)
array([ 8.65630139,  6.84693866, 19.52993307])