The main three methods of normalizing data are:
- Simple Feature Scaling[0,1] \[X_{new} = \frac{X_{old}}{X_{max}}\]
The Code:
df["column_name"] = df["column_name"]/df["column_name"].max()
- Min_Max[0,1] \[X_{new} = \frac{X_{old} - X_{min}}{X_{max} - X_{min}}\]
The Code:
(df["column_name"]-df["column_name"].min/(df["column_name"].max()-df["column_name"].min())
- Z-Score[-3,3] \[X_{new} = \frac{X_{old} - averag of features}{Standard deviation (sigma)}\]
The Code:
df["column_name"] = (df["column_name"] -df["column_name"].mean()/df["column_name"].std()
0 Comments:
Post a Comment