text_plain_output_1.png
from sklearn.model_selection import GridSearchCV

from sklearn.neighbors import KNeighborsClassifier

from sklearn.pipeline import make_pipeline

from sklearn.preprocessing import StandardScaler

pipe = make_pipeline(StandardScaler(), KNeighborsClassifier())

param_grid = {'kneighborsclassifier__n_neighbors': range(1, 30)}

cv = GridSearchCV(pipe, param_grid=param_grid, cv=5)
cv.fit(X_train, y_train)