Last active
August 10, 2020 08:03
-
-
Save purva91/037c83e2d4277785f0e196fcd767dfdd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
train_score = [] | |
test_score = [] | |
k_vals = [] | |
for k in range(1, 21): | |
k_vals.append(k) | |
knn = KNeighborsClassifier(n_neighbors = k) | |
knn.fit(X_train, y_train) | |
tr_score = knn.score(X_train, y_train) | |
train_score.append(tr_score) | |
te_score = knn.score(X_test, y_test) | |
test_score.append(te_score) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment