Dtreeviz Utility for Google Collab

I am having issues using the dtreeviz utility from lesson 9.

It does not work despite including the updated library with

!pip install -Uqq waterfallcharts treeinterpreter dtreeviz



dtreeviz(m,xs.iloc[samp_idx],y.iloc[samp_idx],xs.columns,"input",fontname='DejaVu Sans',scale = 1.6,label_fontsize=10,orientation='LR')

throws the following error:

NameError: name 'dtreeviz' is not defined

Help is appreciated.


Did you try to follow these install steps: GitHub - parrt/dtreeviz: A python library for decision tree visualization and model interpretation.

Thank you for the recommendation, @miwojc. I am using Google Collab, so this prompted me to look up the installation guide for that IDE. This notebook provided a solution:

import sys

if 'google.colab' in sys.modules:
  !pip install -q dtreeviz

import sys
import os
# add library module to PYTHONPATH

from sklearn.datasets import *
from dtreeviz.trees import *
from IPython.display import Image, display_svg, SVG
1 Like