mae¶
Import path: earth2studio.statistics.mae
Documentation¶
Bases: rmse
Statistic for calculating the mean absolute error of two arrays 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 | ndarray | None, default:None) –An array 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__ ¶
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.
If batch_update was passed True upon metric initialization then this method returns the running sample MAE over all seen batches.
Parameters:
-
x(DataArray) –Input array, typically the forecast or prediction array, but MAE is symmetric with respect to
xandy.reduction_dimensionsmust be in the dimensions of x. -
y(DataArray) –Input array #2 intended to be used as validation data, but MAE is symmetric with respect to
xandy.
Returns:
-
DataArray–Returns mean absolute error array with appropriate reduced coordinates.