text_plain_output_1.png image_output_1.png
from sklearn.neighbors import KNeighborsClassifier

from sklearn.preprocessing import StandardScaler

from sklearn.tree import DecisionTreeClassifier

import numpy as np

from sklearn.preprocessing import StandardScaler
sc = StandardScaler(with_mean=False)

X_train = sc.fit_transform(X_train)
X_test = sc.transform(X_test)

from sklearn.tree import DecisionTreeClassifier
classifier = DecisionTreeClassifier(criterion='entropy', random_state=0)
classifier.fit(X_train, y_train)

y_pred = classifier.predict(X_test)

y_test = np.array(y_test)
y_pred = np.array(y_pred)

from sklearn.neighbors import KNeighborsClassifier
kNN = KNeighborsClassifier(n_neighbors=20)
kNN.fit(X_train, y_train)
print(kNN.score(X_train, y_train))
print(kNN.score(X_test, y_test))