dataset
Data_Feature_Scaling.xlsx
0.01MB
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn import preprocessing
data_set = pd.read_excel('/content/Data_Feature_Scaling.xlsx')
data_set.head()
#here Features - Age and Salary columns
#are taken using slicing
#to handle values with varying magnitude
x = data_set.iloc[:,1:3].values
print("\nOriginal data values : \n",x)
""" MIN MAX SCALER """
min_max_scaler = preprocessing.MinMaxScaler(feature_range=(0,1))
#Scaled feature
min_max_scaler.fit(x)
x_after_min_max_scaler = min_max_scaler.transform(x)
print ("\nAfter min max Scaling : \n",x_after_min_max_scaler)
""" Standardisation """
Standardisation = preprocessing.StandardScaler()
#Scaled feature
Standardisation.fit(x)
x_after_Standardisation = Standardisation.transform(x)
print ("\nAfter Standardisation : \n",x_after_Standardisation)
https://github.com/erica00j/machinelearning/blob/main/Feature_Scaling.ipynb
'인공지능 > Machine Learning' 카테고리의 다른 글
[ML] Logistic Regression (로지스틱 회귀) (0) | 2022.11.15 |
---|---|
[ML] K-means clustering 예제 (1) | 2022.10.18 |
[ML] Linear Regression (선형 회귀) 예제 (0) | 2022.10.18 |
[ML] Linear Regression (선형 회귀) (0) | 2022.10.18 |
[ML] Evaluation / Classification Report (precision, recall, F1 score) (0) | 2022.10.17 |
댓글