statistics.variance¶
Import path: earth2studio.statistics.variance
Documentation¶
Statistic for calculating the sample variance 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 variance 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 variance. By default False.
__call__ ¶
Apply the sample variance operation over the tensor x.
If batch_update was passed True upon metric initialization then this method returns the running sample variance over all seen batches.
Parameters:
-
x(Tensor) –Input data to compute sample variance.
-
coords(CoordSystem) –Coordinates referring to the input data, x.