text_plain_output_1.png
from sklearn.neighbors import KNeighborsClassifier

import sklearn.metrics as pm

knn_model = KNeighborsClassifier(n_neighbors=7)
knn_model.fit(X_train, y_train)
y_pred = knn_model.predict(X_test)

import sklearn.metrics as pm
pm.confusion_matrix(y_test, y_pred)

tn, fp, fn, tp = pm.confusion_matrix(y_test, y_pred).ravel()
print('true negative: ', tn)
print('false positive: ', fp)
print('false negative: ', fn)
print('true positive: ', tp)