Skip to content

Instantly share code, notes, and snippets.

@marcelcaraciolo
Created May 2, 2014 05:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcelcaraciolo/da2d7b94e10deffdbfdc to your computer and use it in GitHub Desktop.
Save marcelcaraciolo/da2d7b94e10deffdbfdc to your computer and use it in GitHub Desktop.
from sklearn.neighbors import KNeighborsClassifier
from sklearn.metrics import confusion_matrix
clf = KNeighborsClassifier(n_neighbors=13)
clf.fit(X_train, y_train)
print "done"
print "="*20
print clf
print "Confusion Matrix"
print "="*40
print confusion_matrix(y_test, clf.predict(X_test))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment