Skip to content

Commit

Permalink
Test monotone constraints with column split (#9613)
Browse files Browse the repository at this point in the history
  • Loading branch information
rongou authored Sep 27, 2023
1 parent 7cafd41 commit 3f2093f
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/cpp/test_learner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,11 @@ void TestColumnSplitInteractionConstraints(std::string const& tree_method, bool
Args args{{"interaction_constraints", "[[0, 5, 7], [2, 8, 9], [1, 3, 6]]"}};
TestColumnSplitWithArgs(tree_method, use_gpu, args);
}

void TestColumnSplitMonotoneConstraints(std::string const& tree_method, bool use_gpu) {
Args args{{"monotone_constraints", "(1,-1,0,1,1,-1,-1,0,0,1)"}};
TestColumnSplitWithArgs(tree_method, use_gpu, args);
}
} // anonymous namespace

TEST(ColumnSplitColumnSampler, Approx) { TestColumnSplitColumnSampler("approx", false); }
Expand Down Expand Up @@ -803,4 +808,22 @@ TEST(MGPUColumnSplitInteractionConstraints, GPUHist) {
TestColumnSplitInteractionConstraints("hist", true);
}
#endif // defined(XGBOOST_USE_CUDA)

TEST(ColumnSplitMonotoneConstraints, Approx) {
TestColumnSplitMonotoneConstraints("approx", false);
}

TEST(ColumnSplitMonotoneConstraints, Hist) {
TestColumnSplitMonotoneConstraints("hist", false);
}

#if defined(XGBOOST_USE_CUDA)
TEST(MGPUColumnSplitMonotoneConstraints, GPUApprox) {
TestColumnSplitMonotoneConstraints("approx", true);
}

TEST(MGPUColumnSplitMonotoneConstraints, GPUHist) {
TestColumnSplitMonotoneConstraints("hist", true);
}
#endif // defined(XGBOOST_USE_CUDA)
} // namespace xgboost

0 comments on commit 3f2093f

Please sign in to comment.