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

Method aggregate

mla/knn.py:61–65  ·  view source on GitHub ↗

Return the most common target label.

(self, neighbors_targets)

Source from the content-addressed store, hash-verified

59 the predicted label is arbitrary."""
60
61 def aggregate(self, neighbors_targets):
62 """Return the most common target label."""
63
64 most_common_label = Counter(neighbors_targets).most_common(1)[0][0]
65 return most_common_label
66
67
68class KNNRegressor(KNNBase):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected