1

Following is my code:

from sklearn import tree
from dtreeviz.trees import dtreeviz # will be used for tree visualization
from matplotlib import pyplot as plt
import graphviz

ax2 = dtreeviz(
 RFC1.estimators_[0],
 X_train1, y_train1, target_name='Mask',
 scale=1.1, class_names=['0','1'])
ax2

As I am working on jupyter notebook so I can see the graph as soon as I run ax2. I want to save this output to on my local system in PNG format BUT I can find a way to do this!

Karar Shah
  • 11
  • 2

2 Answers2

1

Now its works different

Here is tutorial

It looks like:

import dtreeviz
viz_model = dtreeviz.model(clf,
                       X_train=X, y_train=y,
                       feature_names=iris.feature_names,
                       target_name='iris',
                       class_names=iris.target_names)

v = viz_model.view()     # render as SVG into internal object 
v.show()                 # pop up window
v.save("/tmp/iris.svg")  # optionally save as svg
0

You can save it to svg format.

viz = dtreeviz(spark_dtree)

viz.save("/path/dtreeviz.svg")