XGBoost from JSON
Introduction
The purpose of this Vignette is to show you how to correctly load and work with an XGBoost model that has been dumped to JSON. XGBoost internally converts all data to 32-bit floats, and the values dumped to JSON are decimal representations of these values. When working with a model that has been parsed from a JSON file, care must be taken to correctly treat:
the input data, which should be converted to 32-bit floats
any 32-bit floats that were stored in JSON as decimal representations
any calculations must be done with 32-bit mathematical operators
Setup
For the purpose of this tutorial we will load the xgboost, jsonlite, and float packages. We’ll also set digits=22 in our options in case we want to inspect many digits of our results.
require(xgboost)