19 #include <rapidjson/document.h>
20 #include <rapidjson/stringbuffer.h>
21 #include <rapidjson/writer.h>
24 const int64_t num_logical_features) {
25 rapidjson::Document model_metadata_doc;
26 model_metadata_doc.Parse(model_metadata_json.c_str());
27 if (model_metadata_doc.HasMember(
"predicted") &&
28 model_metadata_doc[
"predicted"].IsString()) {
29 predicted_ = model_metadata_doc[
"predicted"].GetString();
31 if (model_metadata_doc.HasMember(
"training_query") &&
32 model_metadata_doc[
"training_query"].IsString()) {
35 if (model_metadata_doc.HasMember(
"features") &&
36 model_metadata_doc[
"features"].IsArray()) {
37 const rapidjson::Value& features_array = model_metadata_doc[
"features"];
38 for (
const auto& feature : features_array.GetArray()) {
39 features_.emplace_back(feature.GetString());
42 features_.resize(num_logical_features,
"");
44 if (model_metadata_doc.HasMember(
"data_split_train_fraction") &&
45 model_metadata_doc[
"data_split_train_fraction"].IsDouble()) {
48 model_metadata_doc[
"data_split_train_fraction"].GetDouble();
50 if (model_metadata_doc.HasMember(
"data_split_eval_fraction") &&
51 model_metadata_doc[
"data_split_eval_fraction"].IsDouble()) {
54 model_metadata_doc[
"data_split_eval_fraction"].GetDouble();
56 if (model_metadata_doc.HasMember(
"feature_permutations") &&
57 model_metadata_doc[
"feature_permutations"].IsArray()) {
58 const rapidjson::Value& feature_permutations_array =
59 model_metadata_doc[
"feature_permutations"];
60 for (
const auto& feature_permutation : feature_permutations_array.GetArray()) {