meridian.model.transformers.CenteringAndScalingTransformer

Applies centering and scaling transformations to a tensor.

Inherits From: TensorTransformer

This class transforms a tensor so each variable has mean zero and standard deviation one. Optionally, each variable can be scaled by population before the centering and scaling transformations are applied. The class stores the mean and standard deviation of each variable.

tensor A tensor of dimension (n_geos, n_times, n_channel) used to compute the means and standard deviations.
population A tensor of dimension (n_geos,) containing the population of each geo, used to compute the scale factors.
population_scaling_id An optional boolean tensor of dimension (n_channels,) indicating the variables for which the value will be scaled by population.

Methods

forward

View source

Scales a given tensor using the stored coefficients.

Args
tensor A tensor of dimension (n_geos, n_times, n_channels) to transform.
apply_population_scaling Whether to apply population scaling before the normalization by means and standard deviations.

inverse

View source

Scales back a given tensor using the stored coefficients.