Reduce tree expand boilerplate code (#4008)

This commit is contained in:
Rory Mitchell
2018-12-20 15:52:28 +13:00
committed by GitHub
parent 84c99f86f4
commit f75a21af25
9 changed files with 34 additions and 43 deletions

View File

@@ -38,7 +38,7 @@ TEST(Updater, Prune) {
pruner->Init(cfg);
// loss_chg < min_split_loss;
tree.AddChilds(0);
tree.ExpandNode(0, 0, 0, true);
int cleft = tree[0].LeftChild();
int cright = tree[0].RightChild();
tree[cleft].SetLeaf(0.3f, 0);
@@ -48,7 +48,7 @@ TEST(Updater, Prune) {
ASSERT_EQ(tree.NumExtraNodes(), 0);
// loss_chg > min_split_loss;
tree.AddChilds(0);
tree.ExpandNode(0, 0, 0, true);
cleft = tree[0].LeftChild();
cright = tree[0].RightChild();
tree[cleft].SetLeaf(0.3f, 0);

View File

@@ -29,7 +29,7 @@ TEST(Updater, Refresh) {
std::vector<RegTree*> trees {&tree};
std::unique_ptr<TreeUpdater> refresher(TreeUpdater::Create("refresh"));
tree.AddChilds(0);
tree.ExpandNode(0, 0, 0, true);
int cleft = tree[0].LeftChild();
int cright = tree[0].RightChild();
tree[cleft].SetLeaf(0.2f, 0);