hello,
I am on chapter 9 fastbook/09_tabular.ipynb at master · fastai/fastbook · GitHub
and am trying to run this line of code:
draw_tree(m, xs, size=10, leaves_parallel=True, precision=2)
but I cannot figure out where/how to import draw_tree
hello,
I am on chapter 9 fastbook/09_tabular.ipynb at master · fastai/fastbook · GitHub
and am trying to run this line of code:
draw_tree(m, xs, size=10, leaves_parallel=True, precision=2)
but I cannot figure out where/how to import draw_tree
Here’s the notebook where Jeremy defines draw_tree
:
import graphviz
def draw_tree(t, df, size=10, ratio=0.6, precision=2, **kwargs):
s=export_graphviz(t, out_file=None, feature_names=df.columns, filled=True, rounded=True,
special_characters=True, rotate=False, precision=precision, **kwargs)
return graphviz.Source(re.sub('Tree {', f'Tree {{ size={size}; ratio={ratio}', s))
hello you can use it in this way
!pip install fastbook
from fastbook import draw_tree