python中使用scikit-learn的决策树算法运行错误 10
按照官方教程http://scikit-learn.org/stable/modules/tree.html#classification,在python中使用sciki...
按照官方教程http://scikit-learn.org/stable/modules/tree.html#classification,
在python中使用scikit-learn的决策树算法分类:
>>> from sklearn.datasets import load_iris
>>> from sklearn import tree
>>> iris = load_iris()
>>> clf = tree.DecisionTreeClassifier()
>>> clf = clf.fit(iris.data, iris.target)
>>> from sklearn.externals.six import StringIO
>>> with open("iris.dot", 'w') as f:
f = tree.export_graphviz(clf, out_file=f)
结果出现以下错误:
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
with open("iris.dot", 'w') as f:
IOError: [Errno 13] Permission denied: 'iris.dot'
>>>
请问该如何解决? 展开
在python中使用scikit-learn的决策树算法分类:
>>> from sklearn.datasets import load_iris
>>> from sklearn import tree
>>> iris = load_iris()
>>> clf = tree.DecisionTreeClassifier()
>>> clf = clf.fit(iris.data, iris.target)
>>> from sklearn.externals.six import StringIO
>>> with open("iris.dot", 'w') as f:
f = tree.export_graphviz(clf, out_file=f)
结果出现以下错误:
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
with open("iris.dot", 'w') as f:
IOError: [Errno 13] Permission denied: 'iris.dot'
>>>
请问该如何解决? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询