Pseudo-huber loss metric added (#5647)

- Add pseudo huber loss objective.
- Add pseudo huber loss metric.

Co-authored-by: Reetz <s02reetz@iavgroup.local>
This commit is contained in:
LionOrCatThatIsTheQuestion
2020-05-18 15:08:07 +02:00
committed by GitHub
parent 535479e69f
commit 83981a9ce3
6 changed files with 89 additions and 0 deletions

View File

@@ -44,6 +44,18 @@ TEST(Metric, DeclareUnifiedTest(MAE)) {
delete metric;
}
TEST(Metric, DeclareUnifiedTest(MPHE)) {
auto lparam = xgboost::CreateEmptyGenericParam(GPUIDX);
xgboost::Metric * metric = xgboost::Metric::Create("mphe", &lparam);
metric->Configure({});
ASSERT_STREQ(metric->Name(), "mphe");
EXPECT_NEAR(GetMetricEval(metric, {0, 1}, {0, 1}), 0, 1e-10);
EXPECT_NEAR(GetMetricEval(metric,
{0.1f, 0.9f, 0.1f, 0.9f},
{ 0, 0, 1, 1}), 0.17517f, 1e-4);
delete metric;
}
TEST(Metric, DeclareUnifiedTest(LogLoss)) {
auto lparam = xgboost::CreateEmptyGenericParam(GPUIDX);
xgboost::Metric * metric = xgboost::Metric::Create("logloss", &lparam);