MCPcopy Create free account
hub / github.com/dmlc/xgboost / TestSquaredLog

Function TestSquaredLog

tests/cpp/objective/test_regression_obj.cc:62–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62void TestSquaredLog(const Context* ctx) {
63 std::string obj_name = "reg:squaredlogerror";
64 std::vector<std::pair<std::string, std::string>> args;
65
66 std::unique_ptr<ObjFunction> obj{ObjFunction::Create(obj_name, ctx)};
67 obj->Configure(args);
68 CheckConfigReload(obj, obj_name);
69 // clang-format off
70 CheckObjFunction(obj,
71 {0.1f, 0.2f, 0.4f, 0.8f, 1.6f}, // pred
72 {1.0f, 1.0f, 1.0f, 1.0f, 1.0f}, // labels
73 {1.0f, 1.0f, 1.0f, 1.0f, 1.0f}, // weights
74 {-0.5435f, -0.4257f, -0.25475f, -0.05855f, 0.1009f},
75 { 1.3205f, 1.0492f, 0.69215f, 0.34115f, 0.1091f});
76 CheckObjFunction(obj,
77 {0.1f, 0.2f, 0.4f, 0.8f, 1.6f}, // pred
78 {1.0f, 1.0f, 1.0f, 1.0f, 1.0f}, // labels
79 {}, // empty weights
80 {-0.5435f, -0.4257f, -0.25475f, -0.05855f, 0.1009f},
81 { 1.3205f, 1.0492f, 0.69215f, 0.34115f, 0.1091f});
82 // clang-format on
83 ASSERT_EQ(obj->DefaultEvalMetric(), std::string{"rmsle"});
84}
85
86void TestLogisticRegressionGPair(const Context* ctx) {
87 std::string obj_name = "reg:logistic";

Callers 2

TESTFunction · 0.85
TESTFunction · 0.85

Calls 4

CheckConfigReloadFunction · 0.85
CheckObjFunctionFunction · 0.85
ConfigureMethod · 0.45
DefaultEvalMetricMethod · 0.45

Tested by

no test coverage detected