Scaling
Normalise data with various scaling methods
Last updated
Normalise data with various scaling methods
Last updated
Feature scaling normalises data to improve model accuracy and comparability across features.
Key methods include:
Max scaler Scales features between -1 and 1 using absolute max, sensitive to outliers.
Min-Max scaler Scales features to a specified range, e.g., [0,1], but sensitive to outliers.
Robust scaler Uses median and interquartile range, resistant to outliers.
Standard scaler Centers data around 0 with standard deviation of 1, ideal for normally distributed data.
These methods offer flexibility by allowing custom variables for optimal data scaling.
The Max Scaler sets the data between -1 and 1. It scales data according to the absolute maximum, this scaler is not suitable for outliers.
It needs data pre-processing, such as handling outliers.
Attribute | Description | Type | Required |
---|---|---|---|
Transform features by scaling each feature to a given range.
This estimator scales and translates each feature individually such that it is in the given range on the training set, i.e. between zero and one. This scaler shrinks the data within the range of -1 to 1, if there are negative values.
We can set the range [0,1] or [0,5] or [-1,1]. This Scaler responds well if the standard deviation is small and the distribution is not Gaussian.
This scaler is sensitive to outliers.
The robust scaler is a median-based scaling method.
The formula of robust scaler
is (Xi-Xmedian) Xiqr. This scalar is not affected by outliers.
Since it uses the interquartile range, it absorbs the effects of outliers while scaling. The interquartile range (Q3 — Q1) has half the data point. If we have outliers that might affect the results or statistics and do not want to remove them, robust scaler
is the best choice.
The standard scaler assumes data is normally distributed within each feature and scales them such that the distribution centered around 0, with a standard deviation of 1.
Centering and scaling happen independently on each feature by computing the relevant statistics on the samples in the training set.
If data is not normally distributed, this is not the best scaler to use.
Attribute | Description | Type | Required |
---|---|---|---|
Attribute | Description | Type | Required |
---|---|---|---|
Attribute | Description | Type | Required |
---|---|---|---|
absolute max
The column absolute max of the feature
Double
min
The column min of the feature
Double array
max
The column max of the feature
Double array
interval
Double array
median
The column min of the feature
Double
q1
The column Q1 interquartile range of the feature
Double
q3
The column Q3 interquartile range of the feature
Double
iqr
The calculated interquartile range difference of q3 and q1
Double
population mean
The column population mean of the feature
Double
population std
The column population standard deviation of the feature
Double