crps¶
Import path: earth2studio.statistics.crps
Documentation¶
Compute the Continuous Ranked Probability Score (CRPS).
Uses this formula # int [F(x) - 1(x-y)]^2 dx
where F is the emperical CDF and 1(x-y) = 1 if x > y.
This statistic reduces over a single dimension, where the presumed ensemble dimension does not appear in the truth/observation tensor.
Parameters:
-
ensemble_dimension(str) –A name corresponding to a dimension to perform the ensemble reduction over. Example: 'ensemble'
-
reduction_dimensions(list[str] | None, default:None) –A list of dimensions over which to average the crps over. optional, by default none. If none, no additional reduction is done.
-
weights(Tensor, default:None) –A tensor containing weights to assign to the reduction dimensions. Note that these weights must have the same number of dimensions as passed in reduction_dimensions. Example: if reduction_dimensions = ['lat', 'lon'] then assert weights.ndim == 2. By default None.
-
fair(bool, default:False) –If true, the CRPS is calculated using the fair CRPS formula. By default False.
__call__ ¶
__call__(
x: Tensor,
x_coords: CoordSystem,
y: Tensor,
y_coords: CoordSystem,
) -> tuple[Tensor, CoordSystem]
Apply metric to data x and y, checking that their coordinates
are broadcastable. While reducing over reduction_dims.
Parameters:
-
x(Tensor) –Input tensor of ensemble forecast or prediction data. This is the tensor over which the CRPS/CDF is calculated with respect to.
-
x_coords(CoordSystem) –Ordered dict representing coordinate system that describes the
xtensor.reduction_dimensionsmust be in coords. -
y(Tensor) –Observation or validation tensor.
-
y_coords(CoordSystem) –Ordered dict representing coordinate system that describes the
ytensor.reduction_dimensionsmust be in coords.
Returns: