Implement tree model dump with code generator. (#4602)
* Implement tree model dump with a code generator. * Split up generators. * Implement graphviz generator. * Use pattern matching. * [Breaking] Return a Source in `to_graphviz` instead of Digraph in Python package. Co-Authored-By: Philip Hyunsu Cho <chohyu01@cs.washington.edu>
This commit is contained in:
@@ -10,7 +10,7 @@ try:
|
||||
import matplotlib
|
||||
matplotlib.use('Agg')
|
||||
from matplotlib.axes import Axes
|
||||
from graphviz import Digraph
|
||||
from graphviz import Source
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
@@ -57,7 +57,7 @@ class TestPlotting(unittest.TestCase):
|
||||
assert ax.patches[3].get_facecolor() == (0, 0, 1.0, 1.0) # blue
|
||||
|
||||
g = xgb.to_graphviz(bst2, num_trees=0)
|
||||
assert isinstance(g, Digraph)
|
||||
assert isinstance(g, Source)
|
||||
|
||||
ax = xgb.plot_tree(bst2, num_trees=0)
|
||||
assert isinstance(ax, Axes)
|
||||
|
||||
Reference in New Issue
Block a user