text_plain_output_1.png
from sklearn.model_selection import train_test_split, GridSearchCV

from sklearn.neighbors import KNeighborsClassifier

from sklearn.neighbors import KNeighborsClassifier
knn = KNeighborsClassifier()
knn.fit(X_train, y_train)

param = {'n_neighbors': [5, 10, 15, 20, 25, 30], 'p': [2, 3, 4, 5, 6]}
gsc = GridSearchCV(knn, param, cv=5, refit=True)
gsc.fit(X_train, y_train)

gsc.best_estimator_

gsc.best_params_