<aside>
💡
Normalisation rescales data to bring values into a specific range (often [0, 1]) or to ensure a vector's magnitude equals 1.
</aside>
Normalisation is essential in applications where the scale of data can significantly impact results.
- It's particularly important in machine learning models where features have different scales that could bias the learning process, and in neural networks to prevent gradient-related issues during training.
- Distance-based algorithms like k-means clustering or k-nearest neighbors also rely heavily on normalisation to ensure accurate distance calculations.
However, when working with count data (where the absolute numbers carry significant meaning), normalisation could potentially remove important information from the dataset.
Difference between Normalisation and Scaling
The terms normalisation and scaling are often used interchangeably, but they have distinct meanings depending on the context.
graph LR;
A["Original Data:
10, 20, 30, 40"] --> B["Normalisation [0,1]"];
A --> C["Scaling (StandardScaler)"];
B --> D["Result:
0.0, 0.33, 0.67, 1.0"];
C --> E["Result:
-1.34, -0.45, 0.45, 1.34"];
%% Add styling
style A fill:#f9f,stroke:#333,stroke-width:2px
style D fill:#bef,stroke:#333,stroke-width:2px
style E fill:#bef,stroke:#333,stroke-width:2px
Note how the same dataset is transformed differently by normalisation and scaling:
- Normalisation maps values to a fixed range [0,1], maintaining relative proportions;
- Scaling transforms data to have mean=0 and standard deviation=1, resulting in both positive and negative values.
Normalisation:
- Transforms the values of a dataset to a specific range, typically [0, 1] or [-1, 1].
- Ensures that data conforms to a fixed scale, which is useful for algorithms that require bounded inputs.
Scaling:
- Adjusts the magnitude of values relative to their distribution, without necessarily bounding them to a specific range.
- It’s useful when working with datasets in different units or scales. It’s often applied in gradient-based models or algorithms sensitive to data magnitude.
Application
- Use normalisation when your data needs to be in a bounded (specified min and/or max) range.