Wei*_*ang 3 python random-forest scikit-learn
我正在使用 python sklearn RandomForestClassifier 并尝试导出决策树。
基本代码如下:
from sklearn import tree
with open(dot_file_name, 'w') as my_file:
tree.export_graphviz(tree1, out_file = my_file,feature_names = feature_names)
Run Code Online (Sandbox Code Playgroud)
运行python脚本后,出现以下错误:属性错误:'DecisionTreeClassifier'对象没有属性'export_graphviz'
我正在使用 python 2.7。是因为python的版本吗?我必须使用python 3.0吗?
| 归档时间: |
|
| 查看次数: |
12979 次 |
| 最近记录: |