Skip to content

Instantly share code, notes, and snippets.

@herrfeder
Last active January 20, 2020 19:29
Show Gist options
  • Save herrfeder/85d18c7916865ae644f7e11f5dfe6aee to your computer and use it in GitHub Desktop.
Save herrfeder/85d18c7916865ae644f7e11f5dfe6aee to your computer and use it in GitHub Desktop.
X = df_lr[["merc_x", "merc_y"]]
y = df_lr["price_cat"]

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33, random_state=42)
neigh = KNeighborsClassifier(n_neighbors=80)
neigh.fit(X_train, y_train)

y_pred=neigh.predict(X_test)
print("Accuracy: {:.2f}%".format(100*metrics.accuracy_score(y_test, y_pred)))

Accuracy: 44.35%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment