Scaling to Range
The following three techniques are used to transform the feature values
- Min-Max normalization
- Max Abs Scaling
- Hyperbolic Tangent (Tanh) Normalization
a) Min-Max Normalization:
This technique transforms the feature value to a specific range
We use this technique
a) when want to preserve the relationships among the original data points
b) to retain the data points in a scaled format with a bounded interval
c) When algorithms require data in a fixed rang like neural networks
d) only when the data features are continuous and without any significant outliers
e) This technique is highly sensitive to outliers
Formula used:

Where
minmax is the normalized value
X is the original value
minx is the minimum value of the feature values
maxx is the maximum value of the feature values
Function used in Python:
def minmax_normalize(series):
return (series – series.min()) / (series.max() – series.min())
To demonstrate let us download 50_Startups.csv from google
Load the libraries and read the data:

Contains four features and one dependent variable (Profit)
STAT refers to state 1) Newyork 2) California and 3) Florida
Type of the data you handle

Check if any null value is present:

Descriptive statistics of the data given

Assign, separate features and dependent variable and convert them to numerical series

Regression using Ordinary Least Square Method of statsmodels.api lib



Regression using sklearn lib

Find Coefficients and intercept

Yhat(profit) = 48542.24 +0.806049*R&DSpend -0.026987*Administration+0.027027*Marketing Spend +118.514656*STAT
Metrics


Min-Max Normalization technique is applied to feature data:
Load libraries and read data


Separate features and dependent variable(Profit)

Stat represent three states namely 1) Newyork, 2)California and 3) Florida. Let us keep as such. So we drop the feature STAT
Transform other features to scale(0,1) using min-max normalization technique
Define function for transform and call the function for each feature

List the series and zip them into DataFrame

Output- normalized features will appear as shown below

All values are made from 0 to 1
Concatenate the STAT columns with the previous dataframe

Output: Now stat feature is shown on the side of normalized data

data goes up to 49 . Total 50 records. All have been normalized using min-max normalization technique. Now data is ready for further analysis
Check If calculation is done as per formula

From descriptive statistics select min and max for the corresponding feature value
Historgram for each feature



Regression using Ordinary Least Square method (Statsmodels.api Library)


Regression using SciKit learn library

Find Coefficients and Intercept

Metrics

OUTPUT:

MAX-ABS SCALING

Hyperbolic Tangent (Tanh) Normalization

