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

@@ -5,8 +5,8 @@ namespace xgboost {
namespace metric {
TEST(Metric, DeclareUnifiedTest(BinaryAUC)) {
auto tparam = xgboost::CreateEmptyGenericParam(GPUIDX);
std::unique_ptr<Metric> uni_ptr {Metric::Create("auc", &tparam)};
auto ctx = xgboost::CreateEmptyGenericParam(GPUIDX);
std::unique_ptr<Metric> uni_ptr {Metric::Create("auc", &ctx)};
Metric * metric = uni_ptr.get();
ASSERT_STREQ(metric->Name(), "auc");
@@ -49,9 +49,9 @@ TEST(Metric, DeclareUnifiedTest(BinaryAUC)) {
}
TEST(Metric, DeclareUnifiedTest(MultiClassAUC)) {
auto tparam = CreateEmptyGenericParam(GPUIDX);
auto ctx = CreateEmptyGenericParam(GPUIDX);
std::unique_ptr<Metric> uni_ptr{
Metric::Create("auc", &tparam)};
Metric::Create("auc", &ctx)};
auto metric = uni_ptr.get();
// MultiClass
@@ -115,8 +115,8 @@ TEST(Metric, DeclareUnifiedTest(MultiClassAUC)) {
}
TEST(Metric, DeclareUnifiedTest(RankingAUC)) {
auto tparam = CreateEmptyGenericParam(GPUIDX);
std::unique_ptr<Metric> metric{Metric::Create("auc", &tparam)};
auto ctx = CreateEmptyGenericParam(GPUIDX);
std::unique_ptr<Metric> metric{Metric::Create("auc", &ctx)};
// single group
EXPECT_NEAR(GetMetricEval(metric.get(), {0.7f, 0.2f, 0.3f, 0.6f},
@@ -153,9 +153,9 @@ TEST(Metric, DeclareUnifiedTest(RankingAUC)) {
}
TEST(Metric, DeclareUnifiedTest(PRAUC)) {
auto tparam = xgboost::CreateEmptyGenericParam(GPUIDX);
auto ctx = xgboost::CreateEmptyGenericParam(GPUIDX);
xgboost::Metric *metric = xgboost::Metric::Create("aucpr", &tparam);
xgboost::Metric *metric = xgboost::Metric::Create("aucpr", &ctx);
ASSERT_STREQ(metric->Name(), "aucpr");
EXPECT_NEAR(GetMetricEval(metric, {0, 0, 1, 1}, {0, 0, 1, 1}), 1, 1e-10);
EXPECT_NEAR(GetMetricEval(metric, {0.1f, 0.9f, 0.1f, 0.9f}, {0, 0, 1, 1}),
@@ -194,9 +194,9 @@ TEST(Metric, DeclareUnifiedTest(PRAUC)) {
}
TEST(Metric, DeclareUnifiedTest(MultiClassPRAUC)) {
auto tparam = xgboost::CreateEmptyGenericParam(GPUIDX);
auto ctx = xgboost::CreateEmptyGenericParam(GPUIDX);
std::unique_ptr<Metric> metric{Metric::Create("aucpr", &tparam)};
std::unique_ptr<Metric> metric{Metric::Create("aucpr", &ctx)};
float auc = 0;
std::vector<float> labels {1.0f, 0.0f, 2.0f};
@@ -223,9 +223,9 @@ TEST(Metric, DeclareUnifiedTest(MultiClassPRAUC)) {
}
TEST(Metric, DeclareUnifiedTest(RankingPRAUC)) {
auto tparam = xgboost::CreateEmptyGenericParam(GPUIDX);
auto ctx = xgboost::CreateEmptyGenericParam(GPUIDX);
std::unique_ptr<Metric> metric{Metric::Create("aucpr", &tparam)};
std::unique_ptr<Metric> metric{Metric::Create("aucpr", &ctx)};
std::vector<float> labels {1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f};
std::vector<uint32_t> groups {0, 2, 6};

View File

@@ -13,8 +13,8 @@
namespace xgboost {
namespace {
inline void CheckDeterministicMetricElementWise(StringView name, int32_t device) {
auto lparam = CreateEmptyGenericParam(device);
std::unique_ptr<Metric> metric{Metric::Create(name.c_str(), &lparam)};
auto ctx = CreateEmptyGenericParam(device);
std::unique_ptr<Metric> metric{Metric::Create(name.c_str(), &ctx)};
HostDeviceVector<float> predts;
size_t n_samples = 2048;
@@ -48,8 +48,8 @@ namespace xgboost {
namespace metric {
TEST(Metric, DeclareUnifiedTest(RMSE)) {
auto lparam = xgboost::CreateEmptyGenericParam(GPUIDX);
xgboost::Metric * metric = xgboost::Metric::Create("rmse", &lparam);
auto ctx = xgboost::CreateEmptyGenericParam(GPUIDX);
xgboost::Metric * metric = xgboost::Metric::Create("rmse", &ctx);
metric->Configure({});
ASSERT_STREQ(metric->Name(), "rmse");
EXPECT_NEAR(GetMetricEval(metric, {0, 1}, {0, 1}), 0, 1e-10);
@@ -73,8 +73,8 @@ TEST(Metric, DeclareUnifiedTest(RMSE)) {
}
TEST(Metric, DeclareUnifiedTest(RMSLE)) {
auto lparam = xgboost::CreateEmptyGenericParam(GPUIDX);
xgboost::Metric * metric = xgboost::Metric::Create("rmsle", &lparam);
auto ctx = xgboost::CreateEmptyGenericParam(GPUIDX);
xgboost::Metric * metric = xgboost::Metric::Create("rmsle", &ctx);
metric->Configure({});
ASSERT_STREQ(metric->Name(), "rmsle");
EXPECT_NEAR(GetMetricEval(metric, {0, 1}, {0, 1}), 0, 1e-10);
@@ -98,8 +98,8 @@ TEST(Metric, DeclareUnifiedTest(RMSLE)) {
}
TEST(Metric, DeclareUnifiedTest(MAE)) {
auto lparam = xgboost::CreateEmptyGenericParam(GPUIDX);
xgboost::Metric * metric = xgboost::Metric::Create("mae", &lparam);
auto ctx = xgboost::CreateEmptyGenericParam(GPUIDX);
xgboost::Metric * metric = xgboost::Metric::Create("mae", &ctx);
metric->Configure({});
ASSERT_STREQ(metric->Name(), "mae");
EXPECT_NEAR(GetMetricEval(metric, {0, 1}, {0, 1}), 0, 1e-10);
@@ -123,8 +123,8 @@ TEST(Metric, DeclareUnifiedTest(MAE)) {
}
TEST(Metric, DeclareUnifiedTest(MAPE)) {
auto lparam = xgboost::CreateEmptyGenericParam(GPUIDX);
xgboost::Metric * metric = xgboost::Metric::Create("mape", &lparam);
auto ctx = xgboost::CreateEmptyGenericParam(GPUIDX);
xgboost::Metric * metric = xgboost::Metric::Create("mape", &ctx);
metric->Configure({});
ASSERT_STREQ(metric->Name(), "mape");
EXPECT_NEAR(GetMetricEval(metric, {150, 300}, {100, 200}), 0.5f, 1e-10);
@@ -148,8 +148,8 @@ TEST(Metric, DeclareUnifiedTest(MAPE)) {
}
TEST(Metric, DeclareUnifiedTest(MPHE)) {
auto lparam = xgboost::CreateEmptyGenericParam(GPUIDX);
std::unique_ptr<xgboost::Metric> metric{xgboost::Metric::Create("mphe", &lparam)};
auto ctx = xgboost::CreateEmptyGenericParam(GPUIDX);
std::unique_ptr<xgboost::Metric> metric{xgboost::Metric::Create("mphe", &ctx)};
metric->Configure({});
ASSERT_STREQ(metric->Name(), "mphe");
EXPECT_NEAR(GetMetricEval(metric.get(), {0, 1}, {0, 1}), 0, 1e-10);
@@ -179,8 +179,8 @@ TEST(Metric, DeclareUnifiedTest(MPHE)) {
}
TEST(Metric, DeclareUnifiedTest(LogLoss)) {
auto lparam = xgboost::CreateEmptyGenericParam(GPUIDX);
xgboost::Metric * metric = xgboost::Metric::Create("logloss", &lparam);
auto ctx = xgboost::CreateEmptyGenericParam(GPUIDX);
xgboost::Metric * metric = xgboost::Metric::Create("logloss", &ctx);
metric->Configure({});
ASSERT_STREQ(metric->Name(), "logloss");
EXPECT_NEAR(GetMetricEval(metric, {0, 1}, {0, 1}), 0, 1e-10);
@@ -208,8 +208,8 @@ TEST(Metric, DeclareUnifiedTest(LogLoss)) {
}
TEST(Metric, DeclareUnifiedTest(Error)) {
auto lparam = xgboost::CreateEmptyGenericParam(GPUIDX);
xgboost::Metric * metric = xgboost::Metric::Create("error", &lparam);
auto ctx = xgboost::CreateEmptyGenericParam(GPUIDX);
xgboost::Metric * metric = xgboost::Metric::Create("error", &ctx);
metric->Configure({});
ASSERT_STREQ(metric->Name(), "error");
EXPECT_NEAR(GetMetricEval(metric, {0, 1}, {0, 1}), 0, 1e-10);
@@ -228,16 +228,16 @@ TEST(Metric, DeclareUnifiedTest(Error)) {
{ 1, 2, 9, 8}),
0.55f, 0.001f);
EXPECT_ANY_THROW(xgboost::Metric::Create("error@abc", &lparam));
EXPECT_ANY_THROW(xgboost::Metric::Create("error@abc", &ctx));
delete metric;
metric = xgboost::Metric::Create("error@0.5f", &lparam);
metric = xgboost::Metric::Create("error@0.5f", &ctx);
metric->Configure({});
EXPECT_STREQ(metric->Name(), "error");
delete metric;
metric = xgboost::Metric::Create("error@0.1", &lparam);
metric = xgboost::Metric::Create("error@0.1", &ctx);
metric->Configure({});
ASSERT_STREQ(metric->Name(), "error@0.1");
EXPECT_STREQ(metric->Name(), "error@0.1");
@@ -262,8 +262,8 @@ TEST(Metric, DeclareUnifiedTest(Error)) {
}
TEST(Metric, DeclareUnifiedTest(PoissionNegLogLik)) {
auto lparam = xgboost::CreateEmptyGenericParam(GPUIDX);
xgboost::Metric * metric = xgboost::Metric::Create("poisson-nloglik", &lparam);
auto ctx = xgboost::CreateEmptyGenericParam(GPUIDX);
xgboost::Metric * metric = xgboost::Metric::Create("poisson-nloglik", &ctx);
metric->Configure({});
ASSERT_STREQ(metric->Name(), "poisson-nloglik");
EXPECT_NEAR(GetMetricEval(metric, {0, 1}, {0, 1}), 0.5f, 1e-10);

View File

@@ -4,16 +4,16 @@
#include "../helpers.h"
TEST(Metric, UnknownMetric) {
auto tparam = xgboost::CreateEmptyGenericParam(GPUIDX);
auto ctx = xgboost::CreateEmptyGenericParam(GPUIDX);
xgboost::Metric * metric = nullptr;
EXPECT_ANY_THROW(metric = xgboost::Metric::Create("unknown_name", &tparam));
EXPECT_NO_THROW(metric = xgboost::Metric::Create("rmse", &tparam));
EXPECT_ANY_THROW(metric = xgboost::Metric::Create("unknown_name", &ctx));
EXPECT_NO_THROW(metric = xgboost::Metric::Create("rmse", &ctx));
if (metric) {
delete metric;
}
metric = nullptr;
EXPECT_ANY_THROW(metric = xgboost::Metric::Create("unknown_name@1", &tparam));
EXPECT_NO_THROW(metric = xgboost::Metric::Create("error@0.5f", &tparam));
EXPECT_ANY_THROW(metric = xgboost::Metric::Create("unknown_name@1", &ctx));
EXPECT_NO_THROW(metric = xgboost::Metric::Create("error@0.5f", &ctx));
if (metric) {
delete metric;
}

View File

@@ -6,8 +6,8 @@
namespace xgboost {
inline void CheckDeterministicMetricMultiClass(StringView name, int32_t device) {
auto lparam = CreateEmptyGenericParam(device);
std::unique_ptr<Metric> metric{Metric::Create(name.c_str(), &lparam)};
auto ctx = CreateEmptyGenericParam(device);
std::unique_ptr<Metric> metric{Metric::Create(name.c_str(), &ctx)};
HostDeviceVector<float> predts;
MetaInfo info;
@@ -43,9 +43,9 @@ inline void CheckDeterministicMetricMultiClass(StringView name, int32_t device)
} // namespace xgboost
inline void TestMultiClassError(int device) {
auto lparam = xgboost::CreateEmptyGenericParam(device);
lparam.gpu_id = device;
xgboost::Metric * metric = xgboost::Metric::Create("merror", &lparam);
auto ctx = xgboost::CreateEmptyGenericParam(device);
ctx.gpu_id = device;
xgboost::Metric * metric = xgboost::Metric::Create("merror", &ctx);
metric->Configure({});
ASSERT_STREQ(metric->Name(), "merror");
EXPECT_ANY_THROW(GetMetricEval(metric, {0}, {0, 0}));
@@ -64,9 +64,9 @@ TEST(Metric, DeclareUnifiedTest(MultiClassError)) {
}
inline void TestMultiClassLogLoss(int device) {
auto lparam = xgboost::CreateEmptyGenericParam(device);
lparam.gpu_id = device;
xgboost::Metric * metric = xgboost::Metric::Create("mlogloss", &lparam);
auto ctx = xgboost::CreateEmptyGenericParam(device);
ctx.gpu_id = device;
xgboost::Metric * metric = xgboost::Metric::Create("mlogloss", &ctx);
metric->Configure({});
ASSERT_STREQ(metric->Name(), "mlogloss");
EXPECT_ANY_THROW(GetMetricEval(metric, {0}, {0, 0}));

View File

@@ -5,9 +5,9 @@
#if !defined(__CUDACC__)
TEST(Metric, AMS) {
auto tparam = xgboost::CreateEmptyGenericParam(GPUIDX);
EXPECT_ANY_THROW(xgboost::Metric::Create("ams", &tparam));
xgboost::Metric * metric = xgboost::Metric::Create("ams@0.5f", &tparam);
auto ctx = xgboost::CreateEmptyGenericParam(GPUIDX);
EXPECT_ANY_THROW(xgboost::Metric::Create("ams", &ctx));
xgboost::Metric* metric = xgboost::Metric::Create("ams@0.5f", &ctx);
ASSERT_STREQ(metric->Name(), "ams@0.5");
EXPECT_NEAR(GetMetricEval(metric, {0, 1}, {0, 1}), 0.311f, 0.001f);
EXPECT_NEAR(GetMetricEval(metric,
@@ -16,7 +16,7 @@ TEST(Metric, AMS) {
0.29710f, 0.001f);
delete metric;
metric = xgboost::Metric::Create("ams@0", &tparam);
metric = xgboost::Metric::Create("ams@0", &ctx);
ASSERT_STREQ(metric->Name(), "ams@0");
EXPECT_NEAR(GetMetricEval(metric, {0, 1}, {0, 1}), 0.311f, 0.001f);
@@ -28,8 +28,8 @@ TEST(Metric, DeclareUnifiedTest(Precision)) {
// When the limit for precision is not given, it takes the limit at
// std::numeric_limits<unsigned>::max(); hence all values are very small
// NOTE(AbdealiJK): Maybe this should be fixed to be num_row by default.
auto tparam = xgboost::CreateEmptyGenericParam(GPUIDX);
xgboost::Metric * metric = xgboost::Metric::Create("pre", &tparam);
auto ctx = xgboost::CreateEmptyGenericParam(GPUIDX);
xgboost::Metric * metric = xgboost::Metric::Create("pre", &ctx);
ASSERT_STREQ(metric->Name(), "pre");
EXPECT_NEAR(GetMetricEval(metric, {0, 1}, {0, 1}), 0, 1e-7);
EXPECT_NEAR(GetMetricEval(metric,
@@ -38,7 +38,7 @@ TEST(Metric, DeclareUnifiedTest(Precision)) {
0, 1e-7);
delete metric;
metric = xgboost::Metric::Create("pre@2", &tparam);
metric = xgboost::Metric::Create("pre@2", &ctx);
ASSERT_STREQ(metric->Name(), "pre@2");
EXPECT_NEAR(GetMetricEval(metric, {0, 1}, {0, 1}), 0.5f, 1e-7);
EXPECT_NEAR(GetMetricEval(metric,
@@ -52,8 +52,8 @@ TEST(Metric, DeclareUnifiedTest(Precision)) {
}
TEST(Metric, DeclareUnifiedTest(NDCG)) {
auto tparam = xgboost::CreateEmptyGenericParam(GPUIDX);
xgboost::Metric * metric = xgboost::Metric::Create("ndcg", &tparam);
auto ctx = xgboost::CreateEmptyGenericParam(GPUIDX);
xgboost::Metric * metric = xgboost::Metric::Create("ndcg", &ctx);
ASSERT_STREQ(metric->Name(), "ndcg");
EXPECT_ANY_THROW(GetMetricEval(metric, {0, 1}, {}));
EXPECT_NEAR(GetMetricEval(metric,
@@ -66,7 +66,7 @@ TEST(Metric, DeclareUnifiedTest(NDCG)) {
0.6509f, 0.001f);
delete metric;
metric = xgboost::Metric::Create("ndcg@2", &tparam);
metric = xgboost::Metric::Create("ndcg@2", &ctx);
ASSERT_STREQ(metric->Name(), "ndcg@2");
EXPECT_NEAR(GetMetricEval(metric, {0, 1}, {0, 1}), 1, 1e-10);
EXPECT_NEAR(GetMetricEval(metric,
@@ -75,7 +75,7 @@ TEST(Metric, DeclareUnifiedTest(NDCG)) {
0.3868f, 0.001f);
delete metric;
metric = xgboost::Metric::Create("ndcg@-", &tparam);
metric = xgboost::Metric::Create("ndcg@-", &ctx);
ASSERT_STREQ(metric->Name(), "ndcg-");
EXPECT_NEAR(GetMetricEval(metric,
xgboost::HostDeviceVector<xgboost::bst_float>{},
@@ -86,7 +86,7 @@ TEST(Metric, DeclareUnifiedTest(NDCG)) {
{ 0, 0, 1, 1}),
0.6509f, 0.001f);
delete metric;
metric = xgboost::Metric::Create("ndcg-", &tparam);
metric = xgboost::Metric::Create("ndcg-", &ctx);
ASSERT_STREQ(metric->Name(), "ndcg-");
EXPECT_NEAR(GetMetricEval(metric,
xgboost::HostDeviceVector<xgboost::bst_float>{},
@@ -98,7 +98,7 @@ TEST(Metric, DeclareUnifiedTest(NDCG)) {
0.6509f, 0.001f);
delete metric;
metric = xgboost::Metric::Create("ndcg@2-", &tparam);
metric = xgboost::Metric::Create("ndcg@2-", &ctx);
ASSERT_STREQ(metric->Name(), "ndcg@2-");
EXPECT_NEAR(GetMetricEval(metric, {0, 1}, {0, 1}), 1, 1e-10);
EXPECT_NEAR(GetMetricEval(metric,
@@ -110,8 +110,8 @@ TEST(Metric, DeclareUnifiedTest(NDCG)) {
}
TEST(Metric, DeclareUnifiedTest(MAP)) {
auto tparam = xgboost::CreateEmptyGenericParam(GPUIDX);
xgboost::Metric * metric = xgboost::Metric::Create("map", &tparam);
auto ctx = xgboost::CreateEmptyGenericParam(GPUIDX);
xgboost::Metric * metric = xgboost::Metric::Create("map", &ctx);
ASSERT_STREQ(metric->Name(), "map");
EXPECT_NEAR(GetMetricEval(metric, {0, 1}, {0, 1}), 1, 1e-10);
EXPECT_NEAR(GetMetricEval(metric,
@@ -131,21 +131,21 @@ TEST(Metric, DeclareUnifiedTest(MAP)) {
0.8611f, 0.001f);
delete metric;
metric = xgboost::Metric::Create("map@-", &tparam);
metric = xgboost::Metric::Create("map@-", &ctx);
ASSERT_STREQ(metric->Name(), "map-");
EXPECT_NEAR(GetMetricEval(metric,
xgboost::HostDeviceVector<xgboost::bst_float>{},
{}), 0, 1e-10);
delete metric;
metric = xgboost::Metric::Create("map-", &tparam);
metric = xgboost::Metric::Create("map-", &ctx);
ASSERT_STREQ(metric->Name(), "map-");
EXPECT_NEAR(GetMetricEval(metric,
xgboost::HostDeviceVector<xgboost::bst_float>{},
{}), 0, 1e-10);
delete metric;
metric = xgboost::Metric::Create("map@2", &tparam);
metric = xgboost::Metric::Create("map@2", &ctx);
ASSERT_STREQ(metric->Name(), "map@2");
EXPECT_NEAR(GetMetricEval(metric, {0, 1}, {0, 1}), 1, 1e-10);
EXPECT_NEAR(GetMetricEval(metric,

View File

@@ -13,8 +13,8 @@ namespace xgboost {
namespace common {
namespace {
inline void CheckDeterministicMetricElementWise(StringView name, int32_t device) {
auto lparam = CreateEmptyGenericParam(device);
std::unique_ptr<Metric> metric{Metric::Create(name.c_str(), &lparam)};
auto ctx = CreateEmptyGenericParam(device);
std::unique_ptr<Metric> metric{Metric::Create(name.c_str(), &ctx)};
metric->Configure(Args{});
HostDeviceVector<float> predts;
@@ -48,7 +48,7 @@ inline void CheckDeterministicMetricElementWise(StringView name, int32_t device)
} // anonymous namespace
TEST(Metric, DeclareUnifiedTest(AFTNegLogLik)) {
auto lparam = xgboost::CreateEmptyGenericParam(GPUIDX);
auto ctx = xgboost::CreateEmptyGenericParam(GPUIDX);
/**
* Test aggregate output from the AFT metric over a small test data set.
@@ -69,7 +69,7 @@ TEST(Metric, DeclareUnifiedTest(AFTNegLogLik)) {
};
for (const auto& test_case : std::vector<TestCase>{ {"normal", 2.1508f}, {"logistic", 2.1804f},
{"extreme", 2.0706f} }) {
std::unique_ptr<Metric> metric(Metric::Create("aft-nloglik", &lparam));
std::unique_ptr<Metric> metric(Metric::Create("aft-nloglik", &ctx));
metric->Configure({ {"aft_loss_distribution", test_case.dist_type},
{"aft_loss_distribution_scale", "1.0"} });
EXPECT_NEAR(metric->Eval(preds, info), test_case.reference_value, 1e-4);
@@ -77,7 +77,7 @@ TEST(Metric, DeclareUnifiedTest(AFTNegLogLik)) {
}
TEST(Metric, DeclareUnifiedTest(IntervalRegressionAccuracy)) {
auto lparam = xgboost::CreateEmptyGenericParam(GPUIDX);
auto ctx = xgboost::CreateEmptyGenericParam(GPUIDX);
MetaInfo info;
info.num_row_ = 4;
@@ -86,7 +86,7 @@ TEST(Metric, DeclareUnifiedTest(IntervalRegressionAccuracy)) {
info.weights_.HostVector() = std::vector<bst_float>();
HostDeviceVector<bst_float> preds(4, std::log(60.0f));
std::unique_ptr<Metric> metric(Metric::Create("interval-regression-accuracy", &lparam));
std::unique_ptr<Metric> metric(Metric::Create("interval-regression-accuracy", &ctx));
EXPECT_FLOAT_EQ(metric->Eval(preds, info), 0.75f);
info.labels_lower_bound_.HostVector()[2] = 70.0f;
EXPECT_FLOAT_EQ(metric->Eval(preds, info), 0.50f);
@@ -102,8 +102,8 @@ TEST(Metric, DeclareUnifiedTest(IntervalRegressionAccuracy)) {
// Test configuration of AFT metric
TEST(AFTNegLogLikMetric, DeclareUnifiedTest(Configuration)) {
auto lparam = xgboost::CreateEmptyGenericParam(GPUIDX);
std::unique_ptr<Metric> metric(Metric::Create("aft-nloglik", &lparam));
auto ctx = xgboost::CreateEmptyGenericParam(GPUIDX);
std::unique_ptr<Metric> metric(Metric::Create("aft-nloglik", &ctx));
metric->Configure({{"aft_loss_distribution", "normal"}, {"aft_loss_distribution_scale", "10"}});
// Configuration round-trip test