O código está respondendo com um erro. E acima, já foi instalado o graphviz.
!pip install graphviz==0.1
!apt-get install graphviz
from sklearn.tree import export_graphviz
import graphviz
dot = export_graphviz(modelo, out_file=None)
grafico = graphviz.Source(dot)
grafico
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-68-4a17e3a347df> in <module>
1 from sklearn.tree import export_graphviz
----> 2 import graphviz
3
4 dot = export_graphviz(modelo, out_file=None)
5 grafico = graphviz.Source(dot)
/usr/local/lib/python3.9/dist-packages/graphviz/__init__.py in <module>
30 __copyright__ = 'Copyright (c) 2014 Sebastian Bank'
31
---> 32 from dot import Digraph, Subgraph
33
34 __all__ = ['Digraph', 'Subgraph']
ModuleNotFoundError: No module named 'dot'
---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
To view examples of installing some common dependencies, click the
"Open Examples" button below.