Skip to content

Instantly share code, notes, and snippets.

@MariaLavrovskaya
Created October 28, 2019 15:11
Show Gist options
  • Save MariaLavrovskaya/c9c2dc0ef01a86340a81926cc38b98b4 to your computer and use it in GitHub Desktop.
Save MariaLavrovskaya/c9c2dc0ef01a86340a81926cc38b98b4 to your computer and use it in GitHub Desktop.
svm_1
#Data preparation
data_1 = data.drop(['id', 'name', 'host_id','host_name','neighbourhood','latitude', 'last_review', 'longitude', 'room_type'], axis =1)
data_1.dropna(how='any', inplace=True)
data_1.head()
#Label Encoding of the labels
from sklearn.preprocessing import LabelEncoder
area_encoder = LabelEncoder()
data_y = data_1['neighbourhood_group']
y = area_encoder.fit_transform(data_y)
#Label Encdoing of the given variables
from sklearn.preprocessing import StandardScaler
data_2 = data_1.drop(['neighbourhood_group'], axis=1)
scaler = StandardScaler()
scaler.fit(data_2)
X = scaler.transform(data_2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment