Visualizing decision tree in scikit-learn

后端 未结 11 2190
广开言路
广开言路 2020-12-02 10:26

I am trying to design a simple Decision Tree using scikit-learn in Python (I am using Anaconda\'s Ipython Notebook with Python 2.7.3 on Windows OS) and visualize it as follo

11条回答
  •  情话喂你
    2020-12-02 11:20

    If you run into issues with grabbing the source .dot directly you can also use Source.from_file like this:

    from graphviz import Source
    from sklearn import tree
    tree.export_graphviz(dtreg, out_file='tree.dot', feature_names=X.columns)
    Source.from_file('tree.dot')
    

提交回复
热议问题