Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
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
109
def
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
KNNClassifier
Class · 0.90
accuracy
Function · 0.90
fit
Method · 0.45
predict
Method · 0.45
Tested by
no test coverage detected