Kubeflow community provides XGBoost Operator to support distributed XGBoost training and batch prediction in a Kubernetes cluster. It provides an easy and efficient XGBoost model training and batch prediction in distributed fashion.
In order to run a XGBoost job in a Kubernetes cluster, carry out the following steps:
Install XGBoost Operator in Kubernetes.
XGBoost Operator is designed to manage XGBoost jobs, including job scheduling, monitoring, pods and services recovery etc. Follow the installation guide to install XGBoost Operator.
Write application code to interface with the XGBoost operator.
You’ll need to furnish a few scripts to inteface with the XGBoost operator. Refer to the Iris classification example.
Data reader/writer: you need to have your data source reader and writer based on the requirement. For example, if your data is stored in a Hive Table, you have to write your own code to read/write Hive table based on the ID of worker.
Model persistence: in this example, model is stored in the OSS storage. If you want to store your model into Amazon S3, Google NFS or other storage, you’ll need to specify the model reader and writer based on the requirement of storage system.
Configure the XGBoost job using a YAML file.
YAML file is used to configure the computation resource and environment for your XGBoost job to run, e.g. the number of workers and masters. The template YAML template is provided for reference.
Submit XGBoost job to Kubernetes cluster.
Kubectl command is used to submit a XGBoost job, and then you can monitor the job status.
XGBoost Model serving
Distributed data reader/writer from/to HDFS, HBase, Hive etc.
Model persistence on Amazon S3, Google NFS etc.