This package provides an interface to XGBoost through the its c_api. To install the package follow the standard CMSSW guidelines and the additional steps below.
cmsrel X_Y_Z
cd X_Y_Z/src
cmsenv
git cms-init
git clone https://github.com/simonepigazzini/XGBoostCMSSW.git
cp XGBoostCMSSW/XGBoostInterface/toolbox/*xml $CMSSW_BASE/config/toolbox/$SCRAM_ARCH/tools/selected/
scram setup rabit
scram setup xgboost
scram b -j
The last two steps should print out a confirmation that the relevant libraries have been succesfully loaded as CMSSW external tools.
- The package is now setup to be used as any other CMSSW package, see https://github.com/simonepigazzini/PrecisionTiming/blob/TDR/FTLAnalysis/src/TrackPUIDMVA.cc for an example (MVAComputer is a similar class for TMVA, the usage is identical to XGBComputer).
- The file from which the model is loaded should be generated by the
xgboost.Booster.get_dump()(https://xgboost.readthedocs.io/en/latest/python/python_api.html). Note that if you use the XGBoostRegressor or XGBoostClassifier classes you must get the dumper first, so:xgboost.XGBoostClassifier.get_booster().get_dump().
The libxgboost.so file is too large to be handle by dlopen (running a cmsRun job using this package will ends up in an error message).
You should set the LD_PRELOAD with the command provided below before executing the cmsRun command:
- BASH:
export LD_PRELOAD=$CMSSW_BASE/external/$SCRAM_ARCH/lib/libxgboost.so - FISH:
set -x LD_PRELOAD $CMSSW_BASE/external/$SCRAM_ARCH/lib/libxgboost.so