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:
committed by
GitHub
parent
535479e69f
commit
83981a9ce3
@@ -55,6 +55,29 @@ TEST(Objective, DeclareUnifiedTest(SquaredLog)) {
|
||||
ASSERT_EQ(obj->DefaultEvalMetric(), std::string{"rmsle"});
|
||||
}
|
||||
|
||||
TEST(Objective, DeclareUnifiedTest(PseudoHuber)) {
|
||||
GenericParameter tparam = CreateEmptyGenericParam(GPUIDX);
|
||||
std::vector<std::pair<std::string, std::string>> args;
|
||||
|
||||
std::unique_ptr<ObjFunction> obj { ObjFunction::Create("reg:pseudohubererror", &tparam) };
|
||||
obj->Configure(args);
|
||||
CheckConfigReload(obj, "reg:pseudohubererror");
|
||||
|
||||
CheckObjFunction(obj,
|
||||
{0.1f, 0.2f, 0.4f, 0.8f, 1.6f}, // pred
|
||||
{1.0f, 1.0f, 1.0f, 1.0f, 1.0f}, // labels
|
||||
{1.0f, 1.0f, 1.0f, 1.0f, 1.0f}, // weights
|
||||
{-0.668965f, -0.624695f, -0.514496f, -0.196116f, 0.514496f}, // out_grad
|
||||
{ 0.410660f, 0.476140f, 0.630510f, 0.9428660f, 0.630510f}); // out_hess
|
||||
CheckObjFunction(obj,
|
||||
{0.1f, 0.2f, 0.4f, 0.8f, 1.6f}, // pred
|
||||
{1.0f, 1.0f, 1.0f, 1.0f, 1.0f}, // labels
|
||||
{}, // empty weights
|
||||
{-0.668965f, -0.624695f, -0.514496f, -0.196116f, 0.514496f}, // out_grad
|
||||
{ 0.410660f, 0.476140f, 0.630510f, 0.9428660f, 0.630510f}); // out_hess
|
||||
ASSERT_EQ(obj->DefaultEvalMetric(), std::string{"mphe"});
|
||||
}
|
||||
|
||||
TEST(Objective, DeclareUnifiedTest(LogisticRegressionGPair)) {
|
||||
GenericParameter tparam = CreateEmptyGenericParam(GPUIDX);
|
||||
std::vector<std::pair<std::string, std::string>> args;
|
||||
|
||||
Reference in New Issue
Block a user