treeh2ogbmmojo

R: Plot trees from h2o.download_mojo(), keep encountering error


I keep encountering errors when I'm trying to plot trees from h2o.download_mojo(). I followed the official instructions:

# Now download the latest stable h2o release from http://www.h2o.ai/download/
# and run the PrintMojo tool from the command line.
#
# (For MacOS: brew install graphviz)
java -cp h2o.jar hex.genmodel.tools.PrintMojo --tree 0 -i model.zip -o model.gv -f 20 -d 3
dot -Tpng model.gv -o model.png
open model.png

I've made sure I use the latest stable h2o and graphviz installed, while I keep getting this error:

java -cp h2o.jar hex.genmodel.tools.PrintMojo --tree 0 -i model.zip -o model.gv -f 20 -d 3
Error: Could not find or load main class hex.genmodel.tools.PrintMojo

dot -Tpng model.gv -o model.png
Error: dot: can't open model.gv

I'm not familiar with java. It will be great if somebody can help me with this. Thanks very much!


Solution

  • Looks like when you pasted the command, you missed the java - part