Python for Machine Learning | Feature Scaling - Min Max Scaler | Min Max Scaler to scale features

Опубликовано: 12 Январь 2018
на канале: technologyCult
14k
212

Python for Machine Learning - Part 22 - Feature Scaling - Min Max Scaler
Github Link -

Python for Machine Learning - Part 22 - Feature Scaling - Min Max Scaler

Feature Scaling - Topics to be covered
1. Min Max Scalar
2. Standard Scalar
3. Normalize
4. Binarize

from sklearn import preprocessing
import numpy as np

x = np.array([[-400],
[-100],
[0],
[100],
[400]])

minmaxscaler = preprocessing.MinMaxScaler(feature_range=(0,1))

x_scaler = minmaxscaler.fit_transform(x)

print(x_scaler)

(Xi - Xmin) / (Xmax - Xmin)
(-100 -(-400))/(400 -(-400) )
(-100 + 400) / (400 + 400)
300/800 = 3/8

Applying it to 3X3 Matrix

x1 = np.array([[1,2,3],
[4,5,6],
[7,8,9]])

minmaxscaler1 = preprocessing.MinMaxScaler(feature_range=(0,1))

x_scaler1 = minmaxscaler1.fit_transform(x1)

print(x_scaler1)

Applying it to a Pandas Dataset

import pandas as pd

dataset = pd.read_csv('Age-Salary.csv')

features = dataset.iloc[:,[2,3]].values

minmaxscaler_as = preprocessing.MinMaxScaler(feature_range=(0,2))

features_scale = minmaxscaler_as.fit_transform(features)


All Playlist of this youtube channel
====================================

1. Data Preprocessing in Machine Learning


2. Confusion Matrix in Machine Learning, ML, AI


3. Anaconda, Python Installation, Spyder, Jupyter Notebook, PyCharm, Graphviz


4. Cross Validation, Sampling, train test split in Machine Learning


5. Drop and Delete Operations in Python Pandas


6. Matrices and Vectors with python


7. Detect Outliers in Machine Learning


8. TimeSeries preprocessing in Machine Learning


9. Handling Missing Values in Machine Learning


10. Dummy Encoding Encoding in Machine Learning


11. Data Visualisation with Python, Seaborn, Matplotlib


12. Feature Scaling in Machine Learning


13. Python 3 basics for Beginner


14. Statistics with Python


15. Sklearn Scikit Learn Machine Learning


16. Python Pandas Dataframe Operations


17. Linear Regression, Supervised Machine Learning


18 Interiew Questions on Machine Learning and Data Science


19. Jupyter Notebook Operations