Standardizing a Feature with Training Statistics
Centering subtracts a chosen mean. Standardization also divides by a positive scale, often a training standard deviation.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Trace a feature value
With training mean 10 and scale 2, an input of 14 transforms to \((14-10)/2=2\). Applying the same stored parameters makes representations comparable. See variance and scale.
Handle constant features
A zero scale needs a documented behavior because division is undefined. A later sample with a new mean is still transformed using the selected fitted parameters. Train and test boundaries explain that separation.[1]
Reuse the exact fitted transformation on later examples
Suppose a feature's training mean is ten with standard deviation two. A new value fourteen becomes \((14-10)/2=2\). Centering a new batch at its own mean would map the same input differently and change model behavior. See testing preprocessing at serving time.
Train mean 10, standard deviation 2
Transform 14 → 2
Transform 10 → 0
Saved transform is reused for both
Define a policy for constant and missing features
A zero standard deviation cannot be used as a divisor. Choose behavior appropriate to the model and document missing inputs. Save the feature order and transformation parameters with the fitted model.