MCPcopy Create free account
hub / github.com/dmlc/xgboost / ConstructTreeCat

Function ConstructTreeCat

tests/cpp/tree/test_tree_model.cc:198–221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196}
197
198RegTree ConstructTreeCat(std::vector<bst_cat_t>* cond) {
199 RegTree tree;
200 std::vector<uint32_t> cats_storage(common::CatBitField::ComputeStorageSize(33), 0);
201 common::CatBitField split_cats(cats_storage);
202 split_cats.Set(0);
203 split_cats.Set(14);
204 split_cats.Set(32);
205
206 cond->push_back(0);
207 cond->push_back(14);
208 cond->push_back(32);
209
210 tree.ExpandCategorical(0, /*split_index=*/0, cats_storage, true, 0.0f, 2.0,
211 3.00, 11.0, 2.0, 3.0, 4.0);
212 auto left = tree[0].LeftChild();
213 auto right = tree[0].RightChild();
214 tree.ExpandNode(
215 /*nid=*/left, /*split_index=*/1, /*split_value=*/1.0f,
216 /*default_left=*/false, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, /*left_sum=*/0.0f,
217 /*right_sum=*/0.0f);
218 tree.ExpandCategorical(right, /*split_index=*/0, cats_storage, true, 0.0f,
219 2.0, 3.00, 11.0, 2.0, 3.0, 4.0);
220 return tree;
221}
222
223void TestCategoricalTreeDump(std::string format, std::string sep) {
224 std::vector<bst_cat_t> cond;

Callers 1

TestCategoricalTreeDumpFunction · 0.85

Calls 5

ExpandCategoricalMethod · 0.80
ExpandNodeMethod · 0.80
SetMethod · 0.45
LeftChildMethod · 0.45
RightChildMethod · 0.45

Tested by

no test coverage detected