Example #1
0
def knn_predictor(x_train, y_train, x_test, y_test):
	clf = NearestNeighbors(n_neighbors = 5)
	clf.fit(x_train)
	accuracy = clf.score(x_test, y_test)
	f1 = precision_recall_fscore_support(y_test, clf.predict(x_test), average = 'weighted')[2]
	print(accuracy, f1)