I\'m trying to visualize my DecisionTree, but getting the error The code is:
X = [i[1:] for i in dataset]#attribute y = [i[0] for i in dataset] clf = tree.Decisi
In case of using Python 3, just use pydotplus instead of pydot. It will also have a soft installation process by pip.
import pydotplus dot_data = StringIO() tree.export_graphviz(clf, out_file=dot_data) graph = pydotplus.graph_from_dot_data(dot_data.getvalue()) graph.write_pdf("iris.pdf")