Reduce tree expand boilerplate code (#4008)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user