I am trying to run the following code:
from sklearn.datasets import load_iris
from sklearn import tree
import pydot
clf = tree.DecisionTreeClassifier()
iris = load_iris()
clf = clf.fit(iris.data, iris.target)
from sklearn.externals.six import StringIO
from pydot import *
dotfile = StringIO()
tree.export_graphviz(clf, out_file = dotfile)
pydot.graph_from_dot_data(dot_data.getvalue()).write_png("dtree2.png")
and i get the following error: AttributeError: module 'pydot' has no attribute 'graph_from_dot_data'
I have tried hard to find the solution but could not be able to do so. Please someone help me in this regard.