application_vnd.jupyter.stderr_output_1.png
from sklearn.metrics import accuracy_score, confusion_matrix, classification_report

from sklearn.neighbors import KNeighborsClassifier

from sklearn.preprocessing import StandardScaler

scaler = StandardScaler()
X_train = scaler.fit_transform(X_train)
X_test = scaler.transform(X_test)

accuracy = []
iter = 1
for i in range(31, 35):
    knn = KNeighborsClassifier(n_neighbors=i)
    knn.fit(X_train, y_train)
    y_predi = knn.predict(X_test)
    score = accuracy_score(y_test, y_predi)
    accuracy.append(score * 100)
for i in accuracy:
    iter += 1

knn = KNeighborsClassifier(n_neighbors=32)
knn.fit(X_train, y_train)
y_predi = knn.predict(X_test)
score = accuracy_score(y_test, y_predi)
print('ACCURACY OF ' + 'the KNeighboursClassifier model is: ' + str(score * 100) + '%')