Sitemap
Samarthgangurde

Samarthgangurde

Data scientist enthusiast with pro efficient knowledge of machine learning and deep learning. Here for sharing what i learned in last few months because “The

Feature scaling

3 min readJun 5, 2022

In the last article we overviewed standard scaler and min max scaler. In this article we gone learn about robust scaler and maxabsscaler

Press enter or click to view image in full size

Robust Scaler :-

As the name suggests, Scaler that stands strong against outliers,It uses Interquartile range(IQR). Interquartile range (IQR) is the range between the 1st quartile (25th quantile) and the 3rd quartile (75th quantile)

We divide our dataset in four equal parts. 25% of Each part from 100% dataset

This how IQR look likes,

Press enter or click to view image in full size

After every 25% we assign quartile as you see Q1 ,Q2 and Q3 and the range between Q3 and Q1 is interquartile range

If your thinking about mathematical term it uses to scale down its here

Where,Xi :Data point of variable X

Q1(X); First quartile range(range at the 25% of the data)

Q3(X):Third quartile range(range at the 75% of the data)

Get Samarthgangurde’s stories in your inbox

Join Medium for free to get updates from this writer.

Now we gone jump into code implementation of Robust scaler

  • resulting values after implementing Robust scaler have a zero mean and median and a standard deviation of 1, although not skewed by outliers and the outliers are still present with the same relative relationships to other values.
  • It shows arguments like “with centering”, “with scaling” argument controls whether the value is centered to zero & scaled to the IQR (standard deviation set to one) or not and defaults to True.

Maxabs Scaler :-

When it comes to maxabs scaler it takes the absolute maximum value of each feature(column) and divides each value in the feature(column) by the maximum value.

As per mathematical term :-

Where, Xi : Data point of variable X

Max(Xi) : maximum value of variable X

X : New(Scaled) value of X

Let’s dive into code implementation of Maxabs Scaler

Press enter or click to view image in full size
  • This operation scales the data between the range [-1, 1] where as 1 as maximum value and -1 as minimum value of variable
  • It does not shift/center the data & does not destroy any sparsity.

--

--

Samarthgangurde
Samarthgangurde

Written by Samarthgangurde

Data scientist enthusiast with pro efficient knowledge of machine learning and deep learning. Here for sharing what i learned in last few months because “The