def use_tree(X_data,y_data):
tree = DecisionTreeClassifier(criterion='entropy',max_features='sqrt',max_depth=3,random_state=0)
tree.fit(X_data,y_data)
return tree
# hua tu
# X_comined = np.vstack((X_data,X_valid))
# y_comined = np.hstack((y_data,y_valid))
# plot_decision_regions(X_comined,y_comined,classifier=tree,test_idx=range(105,150))
# plt.show()
# export_graphviz(tree,out_file='tree.dot',feature_names = ['petal length','petal width'])
load_feature.py 文件源码
python
阅读 21
收藏 0
点赞 0
评论 0
评论列表
文章目录