机器学习:用6行Python代码开始写第一个机器学习程序

import sklearn
from sklearn import tree
# features = [[140, "smooth"],[130, "smooth"],[150, "bumpy"],[170,  "bumpy"]]
# labels = ["apple", "apple", "orange", "orange"]
features = [[140, 1],[130, 1],[150, 0],[170, 0]]
labels = [0, 0, 1, 1]
clf = tree.DecisionTreeClassifier()
clf = clf.fit(features,labels)
print (clf.predict([[150, 0]]))

猜你喜欢

转载自blog.csdn.net/pySVN8A/article/details/81431759