Disable parameter validation for Scikit-Learn interface. (#5167)
* Disable parameter validation for now. Scikit-Learn passes all parameters down to XGBoost, whether they are used or not. * Add option `validate_parameters`.
This commit is contained in:
@@ -30,8 +30,6 @@ TEST(Monitor, Logging) {
|
||||
run_monitor();
|
||||
output = testing::internal::GetCapturedStderr();
|
||||
ASSERT_EQ(output.size(), 0);
|
||||
|
||||
ConsoleLogger::Configure(Args{{"verbosity", "1"}});
|
||||
}
|
||||
} // namespace common
|
||||
} // namespace xgboost
|
||||
|
||||
@@ -31,12 +31,14 @@ TEST(Learner, Basic) {
|
||||
}
|
||||
|
||||
TEST(Learner, ParameterValidation) {
|
||||
ConsoleLogger::Configure({{"verbosity", "2"}});
|
||||
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("validate_parameters", "1");
|
||||
learner->SetParam("Knock Knock", "Who's there?");
|
||||
learner->SetParam("Silence", "....");
|
||||
learner->SetParam("tree_method", "exact");
|
||||
@@ -45,7 +47,7 @@ TEST(Learner, ParameterValidation) {
|
||||
learner->Configure();
|
||||
std::string output = testing::internal::GetCapturedStderr();
|
||||
|
||||
ASSERT_TRUE(output.find("Parameters: { Knock Knock, Silence } are not used.") != std::string::npos);
|
||||
ASSERT_TRUE(output.find("Parameters: { Knock Knock, Silence }") != std::string::npos);
|
||||
delete pp_mat;
|
||||
}
|
||||
|
||||
|
||||
@@ -334,7 +334,7 @@ TEST_F(SerializationTest, ConfigurationCount) {
|
||||
}
|
||||
ASSERT_EQ(occureences, 2);
|
||||
|
||||
xgboost::ConsoleLogger::Configure({{"verbosity", "1"}});
|
||||
xgboost::ConsoleLogger::Configure({{"verbosity", "2"}});
|
||||
}
|
||||
|
||||
TEST_F(SerializationTest, GPU_CoordDescent) {
|
||||
|
||||
@@ -92,6 +92,8 @@ class TestPickling(unittest.TestCase):
|
||||
status = subprocess.call(args, env=env)
|
||||
assert status == 0
|
||||
|
||||
os.remove(model_path)
|
||||
|
||||
def test_pickled_predictor(self):
|
||||
x, y = build_dataset()
|
||||
train_x = xgb.DMatrix(x, label=y)
|
||||
@@ -129,6 +131,8 @@ class TestPickling(unittest.TestCase):
|
||||
status = subprocess.call(args, env=env)
|
||||
assert status == 0
|
||||
|
||||
os.remove(model_path)
|
||||
|
||||
def test_predict_sklearn_pickle(self):
|
||||
x, y = build_dataset()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user