statistics.mae¶
Import path: earth2studio.statistics.mae
Documentation¶
Bases: rmse
Statistic for calculating the mean absolute error of two tensors over a set of given dimensions.
Parameters:
-
reduction_dimensions(list[str]) –A list of names corresponding to dimensions to perform the statistical reduction over. Example: ['lat', 'lon']
-
weights(Tensor | None, 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.
-
batch_update(bool, default:False) –Whether to apply batch updates to the rmse with each invocation of call. This is particularly useful when data is received in a stream of batches. Each invocation of call will return the running rmse. In particular, it will apply the square root operation after calculating the running mean squared error.
-
ensemble_dimension(str | None, default:None) –Compute ensemble mean over this dimension before computing MAE. If None (default), no reduction is performed.
__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.
If batch_update was passed True upon metric initialization then this method returns the running sample MAE over all seen batches.
Parameters:
-
x(Tensor) –Input tensor, typically the forecast or prediction tensor, but MAE is symmetric with respect to
xandy. -
x_coords(CoordSystem) –Ordered dict representing coordinate system that describes the
xtensor.reduction_dimensionsmust be in coords. -
y(Tensor) –Input tensor #2 intended to be used as validation data, but MAE is symmetric with respect to
xandy. -
y_coords(CoordSystem) –Ordered dict representing coordinate system that describes the
ytensor.reduction_dimensionsmust be in coords.
Returns: