1. Decimal Scaling is an another technique for normalizing the given data.
  2. It is by moving the decimal point of values.
  3. The number of decimal places moved depends on the maximum absolute value in the feature.

Usage:

  •  it is known for its simplicity
  • When range is not known
  • When you prefer simplicity rather than precision you can use this to normalize the given data

Formula

where i is the smallest integer such that max(abs(x)) < 1.

Load libraries and read data

 

Separate features and target(price)

Boxplot – Original data Creation

 

Normalize bedrooms column  using Decimal Scaling

since the length of max_b is 2 we use the formula   bedrooms0 /10^2 = 3/100= 0.03

max bathrooms are 3  bathrooms0 = 1/10^1 = 0.1

Sqft_living max value works out to 13540 – 5 digits so Sqft_living0 = 1180/10^5= 0.0118

Maxium value of Sqft_lot  7 digits  so sqft_lot0 =5650/10^7 = 0.000565

Create Boxplot for the normalized data