MCPcopy Create free account
hub / github.com/antmachineintelligence/mtgbmcode / ToJSON

Method ToJSON

src/io/tree.cpp:248–261  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246}
247
248std::string Tree::ToJSON() const {
249 std::stringstream str_buf;
250 str_buf << std::setprecision(std::numeric_limits<double>::digits10 + 2);
251 str_buf << "\"num_leaves\":" << num_leaves_ << "," << '\n';
252 str_buf << "\"num_cat\":" << num_cat_ << "," << '\n';
253 str_buf << "\"shrinkage\":" << shrinkage_ << "," << '\n';
254 if (num_leaves_ == 1) {
255 str_buf << "\"tree_structure\":{" << "\"leaf_value\":" << leaf_value_[0] << "}" << '\n';
256 } else {
257 str_buf << "\"tree_structure\":" << NodeToJSON(0) << '\n';
258 }
259
260 return str_buf.str();
261}
262
263std::string Tree::NodeToJSON(int index) const {
264 std::stringstream str_buf;

Callers 1

DumpModelMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected