From 9ef85fd822f0ce28de70f3ff214c94f7aa2de1a7 Mon Sep 17 00:00:00 2001 From: Dmitry Khominich Date: Fri, 23 Nov 2018 23:37:25 +0300 Subject: [PATCH] add average_output & objective fields to JSON format (#1850) --- src/boosting/gbdt_model_text.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/boosting/gbdt_model_text.cpp b/src/boosting/gbdt_model_text.cpp index ee17c74b726..cacc061af72 100644 --- a/src/boosting/gbdt_model_text.cpp +++ b/src/boosting/gbdt_model_text.cpp @@ -22,6 +22,10 @@ std::string GBDT::DumpModel(int start_iteration, int num_iteration) const { str_buf << "\"num_tree_per_iteration\":" << num_tree_per_iteration_ << "," << '\n'; str_buf << "\"label_index\":" << label_idx_ << "," << '\n'; str_buf << "\"max_feature_idx\":" << max_feature_idx_ << "," << '\n'; + str_buf << "\"average_output\":" << (average_output_ ? "true" : "false") << ",\n"; + if (objective_function_ != nullptr) { + str_buf << "\"objective\":\"" << objective_function_->ToString() << "\",\n"; + } str_buf << "\"feature_names\":[\"" << Common::Join(feature_names_, "\",\"") << "\"],"