MCPcopy Create free account
hub / github.com/rushter/MLAlgorithms / test_knn

Function test_knn

mla/tests/test_classification_accuracy.py:109–114  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

107
108
109def test_knn():
110 clf = KNNClassifier(k=5)
111
112 clf.fit(X_train, y_train)
113 predictions = clf.predict(X_test)
114 assert accuracy(y_test, predictions) >= 0.95

Callers

nothing calls this directly

Calls 4

KNNClassifierClass · 0.90
accuracyFunction · 0.90
fitMethod · 0.45
predictMethod · 0.45

Tested by

no test coverage detected