In [1]:
import sklearn

In [2]:
features = [[100,"smooth"],[200,"bumpy"],[120,"smooth"],[220,"bumpy"],[110,"smooth"],[240,"bumpy"]]

In [3]:
labels = ["apple","orange","apple","orange","apple","orange"]

In [4]:
#smooth=0, apple=0
#bumpy=1,orange=1
features = [[100,0],[200,1],[120,0],[220,1],[110,0],[240,1]]
labels = [0,1,0,1,0,1]

In [6]:
from sklearn import tree
clf = tree.DecisionTreeClassifier()

In [7]:
clf = clf.fit(features,labels)

In [9]:
print clf.predict([[160,0]])


[0]

In [ ]: