Calculate base_score based on input labels for mae. (#8107)

Fit an intercept as base score for abs loss.
This commit is contained in:
Jiaming Yuan
2022-09-20 20:53:54 +08:00
committed by GitHub
parent 4f42aa5f12
commit fffb1fca52
42 changed files with 999 additions and 343 deletions

View File

@@ -29,5 +29,15 @@ TEST(Numeric, PartialSum) {
ASSERT_EQ(sol, result);
}
}
TEST(Numeric, Reduce) {
Context ctx;
ASSERT_TRUE(ctx.IsCPU());
HostDeviceVector<float> values(20);
auto& h_values = values.HostVector();
std::iota(h_values.begin(), h_values.end(), 0.0f);
auto sum = Reduce(&ctx, values);
ASSERT_EQ(sum, (values.Size() - 1) * values.Size() / 2);
}
} // namespace common
} // namespace xgboost