This is a short example of how you can deploy decision tree models to a Java-based serving system using Treelite.
- Checkout this repository with
git clone --recursive https://github.com/hcho3/treelite-java-example
- Compile Treelite by running
mkdir treelite/build
cd treelite/build
cmake ..
make -j4
cd ../..
- Run the Python script
gencode.py
to compilemushroom.model
into a collection of Java source files. The collection will be saved to a directory namedmodel/
. - Now run
mvn package
inside themodel/
directory. - Run
javac -cp model/target/model-1.0-SNAPSHOT.jar *.java
to compilePredictWrapper.java
andTest.java
. - Run
Test
by typingjava -cp "${PWD}:model/target/model-1.0-SNAPSHOT.jar" Test
.