Performing mean normalization
In mean normalization, we center the variable at 0
and rescale the distribution to the value range, so that its values lie between -1
and 1
. This procedure involves subtracting the mean from each observation and then dividing the result by the difference between the minimum and maximum values, as shown here:
Note
Mean normalization is an alternative to standardization. In both cases, the variables are centered at 0
. In mean normalization, the variance varies, while the values lie between -1
and 1
. On the other hand, in standardization, the variance is set to 1
and the value range varies.
Mean normalization is a suitable alternative for models that need the variables to be centered at zero. However, it is sensitive to outliers and not a suitable option for sparse data, as it will destroy the sparse nature.
How to do it...
In this recipe, we will implement mean normalization with pandas
:
- Let’s import
pandas
and the required...