radarx.retrieve.nowcast_verification.brier_score#

radarx.retrieve.nowcast_verification.brier_score(probability, event, *, dim=None)[source]#

Brier score of probability forecasts of an event.

The mean squared difference between the forecast probability p and the outcome o (1 if the event happened, else 0), Brier (1950) [1]:

BS = mean (p - o)**2

0 is perfect; always forecasting the observed frequency f gives f (1 - f). NaN values are left out.

Parameters:
  • probability (xarray.DataArray) – Probabilities between 0 and 1, e.g. from exceedance_probability().

  • event (xarray.DataArray) – Outcome: boolean or 0 and 1 (NaN: missing). Broadcast against probability.

  • dim (str or sequence of str, optional) – Dimensions to average over. Default: all of them.

Returns:

xarray.DataArray – The score (float32, dimensionless).

Raises:

ValueError – If a probability lies outside 0 to 1 or dim is not a dimension.

Notes

Dask. This function computes the dask array: it averages over the whole fields. The input is loaded into memory and the result is held in memory.

See also

reliability, crps

References

Examples

>>> bs = radarx.retrieve.brier_score(prob, truth >= 35.0)