Feature scaling
Grab your coffee we gone deep dive into Feature scaling techniques
Feature scaling is one of the technique of preprocessing, it is used to normalize/standardized the range of independent variables or features of data, it scale down your features(numerical columns) centered around 0 or in the range (0,1) depending on the scaling technique.
What are those techniques then?
Let’s move toward those techniques
1.Standardization (Standard Scaler)
Standardization scale down your variables so that mean of the values is 0 and the standard deviation(Variance) is 1
let’s see its mathematical equation
where, Xi is data point
mean (u) = sum(x)/count(x)
sd(standard_deviation) = sqrt( sum( (x — mean)² ) / count(x))
what if we try it with data points ?..interesting!
Get Samarthgangurde’s stories in your inbox
Join Medium for free to get updates from this writer.
let’s consider we have five columns 1st one is hour , 2nd one is demand,3rd one is month,4th one is year & 5th one is date [dataset from the analytics Vidhya jobathon]
results after applying standard scaler
- when we Subtracting the mean from the data, that means we are centering data,
2. when we dividing it with standard deviation we are center scaling data
note: It(standardization) assumes that your data points follow a Gaussian distribution (bell curve) However, if our data points aren’t normally distributed i.e. they do not follow Gaussian distribution. Standard Scaler is not a good options
Normalizing Technique(Minmax Scaler)
It’s another technique of scaling your variables, where the minimum value of numerical column is made equal to zero and the maximum value of the numerical column equal to one. It scales down the data within range of 0 to 1
Let’s understand its mathematical equation
where ,Xi is data point
Xmin= Minimum value in X
Xmax=Maximum value in X
Let’s, how does it respond to the dataset?
- fit() function is used on training data to estimate the minimum and maximum observable values
- you can normalize data to train your model by calling the transform() function.
Note:- Sometimes minmax Scaler scales down the variable in the range [-1, 1] if there are negative values in the dataset. This scaling compresses all the inliers in the narrow range [0, 0.005]





