What is normalization in data preprocessing?
Normalization is a data preprocessing technique that rescales numerical values into a common range, often between 0 and 1.
It is commonly used when features have very different numerical ranges.
Simple example
Suppose a feature contains:
10, 20, 30Using min-max normalization to map the values into the range 0 to 1 gives:
0.0, 0.5, 1.0Min-max normalization
A common normalization formula is:
x_normalized = (x - min) / (max - min)where:
xis the original valueminis the minimum value of the featuremaxis the maximum value of the feature
With this transformation, the minimum observed value becomes 0 and the maximum becomes 1.
Why normalization is useful
Normalization can help when an algorithm is sensitive to the magnitude of numerical features.
It can make features easier to compare and prevent a feature with a large numerical range from dominating calculations simply because of its scale.
Normalization does not change the ordering
If one original value is larger than another, it remains larger after min-max normalization.
The relative spacing is also transformed consistently within the observed range.
Be careful with outliers
Min-max normalization depends on the minimum and maximum values.
An extreme outlier can stretch the range and compress most other values into a small portion of the normalized scale.
Fit normalization on training data only
The minimum and maximum values should be calculated from the training set.
The same values should then be used to transform validation, test, and future production data.
This prevents information from evaluation data from leaking into preprocessing.
In short, normalization rescales numerical features into a common range, commonly `0` to `1`, so differences in raw units or magnitude have less influence on scale-sensitive machine learning algorithms.
Learning Sequence
Machine Learning Curriculum
Explore Related Questions
Deepen your understanding across related Machine Learning topics.