Pass infomation about objective to tree methods. (#7385)

* Define the `ObjInfo` and pass it down to every tree updater.
This commit is contained in:
Jiaming Yuan
2021-11-04 01:52:44 +08:00
committed by GitHub
parent ccdabe4512
commit 4100827971
28 changed files with 178 additions and 69 deletions

View File

@@ -34,7 +34,8 @@ TEST(GrowHistMaker, InteractionConstraint) {
RegTree tree;
tree.param.num_feature = kCols;
std::unique_ptr<TreeUpdater> updater { TreeUpdater::Create("grow_histmaker", &param) };
std::unique_ptr<TreeUpdater> updater{
TreeUpdater::Create("grow_histmaker", &param, ObjInfo{ObjInfo::kRegression})};
updater->Configure(Args{
{"interaction_constraints", "[[0, 1]]"},
{"num_feature", std::to_string(kCols)}});
@@ -51,7 +52,8 @@ TEST(GrowHistMaker, InteractionConstraint) {
RegTree tree;
tree.param.num_feature = kCols;
std::unique_ptr<TreeUpdater> updater { TreeUpdater::Create("grow_histmaker", &param) };
std::unique_ptr<TreeUpdater> updater{
TreeUpdater::Create("grow_histmaker", &param, ObjInfo{ObjInfo::kRegression})};
updater->Configure(Args{{"num_feature", std::to_string(kCols)}});
updater->Update(&gradients, p_dmat.get(), {&tree});