16 std::vector<std::string>
result;
24 throw std::runtime_error(
"Expected '[' at the beginning of the JSON array!");
32 }
else if (ch ==
',') {
34 }
else if (ch ==
'"') {
36 std::getline(
stream, feature,
'"');
39 throw std::runtime_error(
"Unexpected character in the JSON array!");
49 throw std::runtime_error(
"Failed to create XGBooster");
52 throw std::runtime_error(
"Failed to load XGBoost model");
53 XGBoosterSetParam(
booster_,
"nthread",
"1");
57 std::ifstream
file(model_features);
59 throw std::runtime_error(
"Failed to open file: " + model_features);
66 for (
const auto& feature :
features) {
88 if (pair.second ==
i) {
89 feature_name = pair.first;
93 throw std::runtime_error(
"Feature is not set: " + feature_name);
96 DMatrixHandle dvalues;
99 bst_ulong out_len = 0;
100 const float*
score =
nullptr;
103 const char*
json = R
"({ 106 "iteration_begin": 0, 108 "strict_shape": false 112 bst_ulong
const* out_shape =
nullptr;
116 XGDMatrixFree(dvalues);
119 assert(out_len == 1 &&
"Unexpected prediction format");
void reset()
Reset feature values.
XGBooster(std::string model_file)
ret
prodAgent to be discontinued
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
std::vector< float > features(const reco::PreId &ecal, const reco::PreId &hcal, double rho, const reco::BeamSpot &spot, noZS::EcalClusterLazyTools &ecalTools)
std::vector< float > features_
std::vector< std::string > read_features(const std::string &content)
void set(std::string name, float value)
std::map< std::string, unsigned int > feature_name_to_index_
void addFeature(std::string name)