InvocationException: No GraphViz binaries found

I am unable to visualize or write a decision tree. How can i do this?

Python version 3.5, Anaconda 3, I even set environment variables

    from sklearn import tree
    model = tree.DecisionTreeClassifier(criterion='gini') 
    model=tree.DecisionTreeClassifier()
    model.fit(trainData,trainLabel)
    model.score(trainData,trainLabel)
    predicted= model.predict(testData)

    from sklearn.externals.six import StringIO
    import pydot 
    import pydotplus
    dot_data = StringIO() 
    tree.export_graphviz(model, out_file=dot_data) 
    graph = pydotplus.graph_from_dot_data(dot_data.getvalue()) 
    print(graph)
    graph.write_pdf("C:\\Users\\anagha\\Desktop\\SynehackData\\DATA\\DATA\\graph.pdf") 

      

mistake:

InvocationException: GraphViz executables not found

      

+3


source to share





All Articles