Rename and extract Context. (#8528)

* Rename `GenericParameter` to `Context`.
* Rename header file to reflect the change.
* Rename all references.
This commit is contained in:
Jiaming Yuan
2022-12-07 04:58:54 +08:00
committed by GitHub
parent 05fc6f3ca9
commit 3e26107a9c
105 changed files with 548 additions and 574 deletions

View File

@@ -17,12 +17,12 @@ TEST(Linear, Shotgun) {
auto p_fmat = xgboost::RandomDataGenerator(kRows, kCols, 0).GenerateDMatrix();
auto lparam = xgboost::CreateEmptyGenericParam(GPUIDX);
auto ctx = xgboost::CreateEmptyGenericParam(GPUIDX);
LearnerModelParam mparam{MakeMP(kCols, .5, 1)};
{
auto updater = std::unique_ptr<xgboost::LinearUpdater>(
xgboost::LinearUpdater::Create("shotgun", &lparam));
auto updater =
std::unique_ptr<xgboost::LinearUpdater>(xgboost::LinearUpdater::Create("shotgun", &ctx));
updater->Configure({{"eta", "1."}});
xgboost::HostDeviceVector<xgboost::GradientPair> gpair(
p_fmat->Info().num_row_, xgboost::GradientPair(-5, 1.0));
@@ -31,11 +31,10 @@ TEST(Linear, Shotgun) {
updater->Update(&gpair, p_fmat.get(), &model, gpair.Size());
ASSERT_EQ(model.Bias()[0], 5.0f);
}
{
auto updater = std::unique_ptr<xgboost::LinearUpdater>(
xgboost::LinearUpdater::Create("shotgun", &lparam));
xgboost::LinearUpdater::Create("shotgun", &ctx));
EXPECT_ANY_THROW(updater->Configure({{"feature_selector", "random"}}));
}
}
@@ -50,11 +49,11 @@ TEST(Linear, coordinate) {
auto p_fmat = xgboost::RandomDataGenerator(kRows, kCols, 0).GenerateDMatrix();
auto lparam = xgboost::CreateEmptyGenericParam(GPUIDX);
auto ctx = xgboost::CreateEmptyGenericParam(GPUIDX);
LearnerModelParam mparam{MakeMP(kCols, .5, 1)};
auto updater = std::unique_ptr<xgboost::LinearUpdater>(
xgboost::LinearUpdater::Create("coord_descent", &lparam));
xgboost::LinearUpdater::Create("coord_descent", &ctx));
updater->Configure({{"eta", "1."}});
xgboost::HostDeviceVector<xgboost::GradientPair> gpair(
p_fmat->Info().num_row_, xgboost::GradientPair(-5, 1.0));