Question: hello. i ' m not getting results in my grid. Its blanks.. what am I doing wrong? 4 7 ] Knn _ nod = KveighborsClassifier

hello. i'm not getting results in my grid. Its blanks.. what am I doing wrong?
47]
Knn_nod = KveighborsClassifier()
knn_parans =?
'n_neighbors' : range (1,4,5)
}.
knn_grid = GridsearchCv(knn_mod, knn_params, cv=5, n_jobs=-1)
knn_grid.fit (x,y)
print('Best Paraneters: ', knn_grid.best_parans_)
print('Best CV score: ', knn_grid.best_score_)
Best Parameters: {'n_neighbors': 1})
Best CV score: 0.9337301587301587
4.C - Visualizing Results
Replace the blank in line 1 of this cell with the name of your parameter dictionary from 4.B. Replace the blank in line 2 with the name of your
GridsearchCV object from 4.B. Then execute this cell to see how the CV scores varied with respect to the hyperparameter values. Use this
graph to determine if you should re-run the previous cell with a different range of hyperparameter values.
n_neighbors = knn_params ["n_neighbors"]
scores = knn_grid.cv_results_['mean_test_score']
plt.figure (figsizen 4,2)
plt.plot(n_neighbors, scores)
plt.xlabel ('n_neighbors')
plt.ylabel('cv score')
plt.grid()
plt.show()
 hello. i'm not getting results in my grid. Its blanks.. what

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!