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.
Args
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-05-05 UTC."],[],["This content describes a `CenteringAndScalingTransformer` class that transforms a tensor by centering (mean zero) and scaling (standard deviation one) its variables. It takes a tensor, population data, and an optional population scaling ID as input. The class stores the mean and standard deviation. It has two main methods: `forward`, which applies the scaling to a tensor, and `inverse`, which reverses the scaling using the stored coefficients. The transformations can be applied channel-wise with the `population_scaling_id`.\n"]]