Require leaf statistics when expanding tree (#4015)

* Cache left and right gradient sums

* Require leaf statistics when expanding tree
This commit is contained in:
Rory Mitchell
2019-01-18 07:12:20 +02:00
committed by Philip Hyunsu Cho
parent 0f8af85f64
commit 1fc37e4749
11 changed files with 143 additions and 85 deletions

View File

@@ -82,12 +82,15 @@ TEST(Param, SplitEntry) {
xgboost::tree::SplitEntry se2;
EXPECT_FALSE(se1.Update(se2));
EXPECT_FALSE(se2.Update(-1, 100, 0, true));
ASSERT_TRUE(se2.Update(1, 100, 0, true));
EXPECT_FALSE(se2.Update(-1, 100, 0, true, xgboost::tree::GradStats(),
xgboost::tree::GradStats()));
ASSERT_TRUE(se2.Update(1, 100, 0, true, xgboost::tree::GradStats(),
xgboost::tree::GradStats()));
ASSERT_TRUE(se1.Update(se2));
xgboost::tree::SplitEntry se3;
se3.Update(2, 101, 0, false);
se3.Update(2, 101, 0, false, xgboost::tree::GradStats(),
xgboost::tree::GradStats());
xgboost::tree::SplitEntry::Reduce(se2, se3);
EXPECT_EQ(se2.SplitIndex(), 101);
EXPECT_FALSE(se2.DefaultLeft());