Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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()
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

What is the basis for Security Concerns in Cloud Computing?

Answered: 1 week ago

Question

Describe the three main Cloud Computing Environments.

Answered: 1 week ago