17 std::vector<std::string>
result;
25 throw std::runtime_error(
"Expected '[' at the beginning of the JSON array!");
33 }
else if (ch ==
',') {
35 }
else if (ch ==
'"') {
37 std::getline(
stream, feature,
'"');
40 throw std::runtime_error(
"Unexpected character in the JSON array!");
50 throw std::runtime_error(
"Failed to create XGBooster");
53 throw std::runtime_error(
"Failed to load XGBoost model");
54 XGBoosterSetParam(
booster_,
"nthread",
"1");
58 std::ifstream
file(model_features);
60 throw std::runtime_error(
"Failed to open file: " + model_features);
67 for (
const auto& feature :
features) {
87 if (pair.second ==
i) {
88 feature_name = pair.first;
92 throw std::runtime_error(
"Feature is not set: " + feature_name);
106 throw std::runtime_error(
"Vector of input features is empty");
110 throw std::runtime_error(
"Feature size mismatch");
112 DMatrixHandle dvalues;
115 bst_ulong out_len = 0;
116 const float*
score =
nullptr;
126 "iteration_begin": 0, 128 "strict_shape": false 133 bst_ulong
const* out_shape =
nullptr;
138 assert(out_len == 1 &&
"Unexpected prediction format");
142 XGDMatrixFree(dvalues);
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
float predict(const int iterationEnd=0)
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)