Skip to content

brier_score

Import path: earth2studio.statistics.brier_score

View source on GitHub

Documentation

Statistic for calculating the Brier score (BS) of one array with respect to another over a set of given dimensions.

Follows the definition here: www.ecmwf.int/sites/default/files/elibrary/2017/17626-ensemble-verification-metrics.pdf

If ensemble_dimension is provided, the forecast probability is inferred by averaging over the ensemble members.

Parameters:

  • reduction_dimensions (list[str]) –

    A list of names corresponding to dimensions to perform the statistical reduction over. Example: ['lat', 'lon']

  • thresholds (ArrayLike) –

    A list of the thresholds applied when calculating BS.

  • ensemble_dimension (str | None, default: None ) –

    Ensemble dimension for computation of probabilistic BS. If None (default), forecast is interpreted as deterministic.

  • batch_update (bool, default: False ) –

    Whether to apply batch updates to the BS with each invocation of call. This is particularly useful when data is recieved in a stream of batches. Each invocation of call will return the running BS.

__call__

__call__(x: DataArray, y: DataArray) -> DataArray

Apply metric to data x and y, reducing over reduction_dims. y must have every dimension of x except the ensemble dimension, if the metric has one, with matching coordinate values; it is transposed to x's order, not broadcast.

Parameters:

  • x (DataArray) –

    Input array, typically the forecast or prediction array. reduction_dimensions must be in the dimensions of x, as must ensemble_dimension if provided in constructor.

  • y (DataArray) –

    Input array #2 intended to be used as validation data. Must not contain ensemble_dimension. reduction_dimensions must be in y.

Returns:

  • DataArray –

    Returns Brier score array with appropriate reduced coordinates and a trailing threshold dimension.