The new TF Decision Forests library is really cool in Colab, and I’m trying to get it working in a Kaggle notebook. Please find below a link to a Kaggle notebook where I’ve successfully used the new Decision Forest library. However, there is an issue with the model_plotter (on bottom of the Kaggle Kernel).
Any suggestion on what can be done to plot the model as it worked without a problem in Google Colab? Thank you!
TF-DF uses D3 for plotting. And it seems (looking at the console of the web browser development tool) that Jupiter does not support the way TF-DF import D3.
A solution, is to re-import D3 in a Jupyer notebook cell:
Note that you might have to clear the cell output and reload the webpage.
Alternatively, or if you don’t have a Jupiter or a Colab nodebook, the model plot can be exported to an html and visualized separably. For example:
with open("/tmp/model.html", "w") as f:
f.write(tfdf.model_plotter.plot_model(model, tree_idx=0, max_depth=3))
# Then, open "/tmp/model.html" in any web browser.