决策树的导出与保存
##用sklearn.tree.export_graphviz()该函数能够导出DOT格式
tree.export_graphviz(estimator,out_file=‘tree.dot’,feature_name=[","])
其中:estimator参数为估计器,out_file参数为导出路径参数,feature_name为特征名字
##用graphviz可以将dot格式文件转换成png或者jpg格式文件
可用pip来安装,命令:“pip install graphviz”
然后运行一下命令行可保存png格式图片
dot -Tpng tree.dot -o tree.png