Rename and extract Context. (#8528)
* Rename `GenericParameter` to `Context`. * Rename header file to reflect the change. * Rename all references.
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user