This project is under Apache 2.0 License.
Directory: xgboost_train
.
Just run train.ipynb
.
- Install
bazelisk
.
You can install bazelisk
in multiple ways, including:
npm install -g @bazel/bazelisk
- using a binary release for Linux, macOS, or Windows
- using Homebrew on macOS
- by compiling from source using Go: `go get github.com/bazelbuild/bazelisk
- Run XGBoostClassifier with Iris dataset:
cd ./xgboost_train
bazelisk run :train
The output model is under xgboost_train/bazel-xgboost_train
.
- Convert (.onnx to .ort) (optional)
If you need to use .ort
model, you can convert with:
python -m onnxruntime.tools.convert_onnx_models_to_ort <onnx model file or dir>
But for xgboost model, .ort
model is 2~3 times larger than original .onnx
model.
Directory: onnx_inference
.
Install Android Studio and run the APK.
The Android architecture is not official supported in XGBoost4j.
Because it's impossible as TensorFlow do not implement the XGBoost backend. If you convert onnx to tf model, you would get this convertion error:
Convert code:
import onnx
from onnx_tf.backend import prepare
# Load the ONNX model
onnx_model = onnx.load("xgbc_iris.onnx")
# Convert the ONNX model to TensorFlow format
tf_model = prepare(onnx_model)
# Save the TensorFlow model
tf_model.export_graph("xgbc_iris.tf")
Convert result (ERROR):
Error: "BackendIsNotSupposedToImplementIt: TreeEnsembleClassifier is not implemented."