Parameter validation (#5157)
* Unused code. * Split up old colmaker parameters from train param. * Fix dart. * Better name.
This commit is contained in:
@@ -30,6 +30,25 @@ TEST(Learner, Basic) {
|
||||
static_assert(std::is_integral<decltype(patch)>::value, "Wrong patch version type");
|
||||
}
|
||||
|
||||
TEST(Learner, ParameterValidation) {
|
||||
size_t constexpr kRows = 1;
|
||||
size_t constexpr kCols = 1;
|
||||
auto pp_mat = CreateDMatrix(kRows, kCols, 0);
|
||||
auto& p_mat = *pp_mat;
|
||||
|
||||
auto learner = std::unique_ptr<Learner>(Learner::Create({p_mat}));
|
||||
learner->SetParam("Knock Knock", "Who's there?");
|
||||
learner->SetParam("Silence", "....");
|
||||
learner->SetParam("tree_method", "exact");
|
||||
|
||||
testing::internal::CaptureStderr();
|
||||
learner->Configure();
|
||||
std::string output = testing::internal::GetCapturedStderr();
|
||||
|
||||
ASSERT_TRUE(output.find("Parameters: { Knock Knock, Silence } are not used.") != std::string::npos);
|
||||
delete pp_mat;
|
||||
}
|
||||
|
||||
TEST(Learner, CheckGroup) {
|
||||
using Arg = std::pair<std::string, std::string>;
|
||||
size_t constexpr kNumGroups = 4;
|
||||
|
||||
Reference in New Issue
Block a user