MCPcopy
hub / github.com/jwasham/practice-python / predict

Method predict

machine-learning/k-nearest-neighbors.py:34–40  ·  view source on GitHub ↗
(self, to_classify)

Source from the content-addressed store, hash-verified

32 self.y_train = training_labels
33
34 def predict(self, to_classify):
35 predictions = []
36 for row in to_classify:
37 label = self.closest(row)
38 predictions.append(label)
39
40 return predictions
41
42iris = datasets.load_iris()
43

Callers 4

mainFunction · 0.80
classifyFunction · 0.80
mainFunction · 0.80

Calls 2

closestMethod · 0.95
appendMethod · 0.80

Tested by

no test coverage detected