MCPcopy Index your code
hub / github.com/jwasham/practice-python / classify

Function classify

machine-learning/fruit-classify.py:15–34  ·  view source on GitHub ↗
(to_classify)

Source from the content-addressed store, hash-verified

13
14
15def classify(to_classify):
16 features = [
17 [90, TEXTURE_BUMPY],
18 [140, TEXTURE_SMOOTH],
19 [130, TEXTURE_SMOOTH],
20 [150, TEXTURE_BUMPY],
21 [170, TEXTURE_BUMPY],
22 ]
23 labels = [
24 LABEL_ORANGE,
25 LABEL_APPLE,
26 LABEL_APPLE,
27 LABEL_ORANGE,
28 LABEL_ORANGE
29 ]
30
31 clf = tree.DecisionTreeClassifier()
32 clf = clf.fit(features, labels)
33
34 return clf.predict(to_classify)
35
36
37def main():

Callers 1

mainFunction · 0.85

Calls 2

fitMethod · 0.80
predictMethod · 0.80

Tested by

no test coverage detected