Skip to content

statistics.mean

Import path: earth2studio.statistics.mean

View source on GitHub

Documentation

Statistic for calculating the sample mean 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, 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.

  • batch_update (bool, default: False ) –

    Whether to applying batch updates to the mean 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 mean. By default False.

__call__

__call__(
    x: Tensor, coords: CoordSystem
) -> tuple[Tensor, CoordSystem]

Apply the mean operation over the tensor x.

If batch_update was passed True upon metric initialization then this method returns the running sample mean over all seen batches.

Parameters:

  • x (Tensor) –

    Input data to compute sample mean.

  • coords (CoordSystem) –

    Coordinates referring to the input data, x.