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

Function TestLinearRegressionGPair

tests/cpp/objective/test_regression_obj.cc:38–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36} // namespace
37
38void TestLinearRegressionGPair(const Context* ctx) {
39 std::string obj_name = "reg:squarederror";
40
41 std::vector<std::pair<std::string, std::string>> args;
42 std::unique_ptr<ObjFunction> obj{ObjFunction::Create(obj_name, ctx)};
43
44 obj->Configure(args);
45 // clang-format off
46 CheckObjFunction(obj,
47 {0, 0.1f, 0.9f, 1, 0, 0.1f, 0.9f, 1},
48 {0, 0, 0, 0, 1, 1, 1, 1},
49 {1, 1, 1, 1, 1, 1, 1, 1},
50 {0, 0.1f, 0.9f, 1.0f, -1.0f, -0.9f, -0.1f, 0},
51 {1, 1, 1, 1, 1, 1, 1, 1});
52 CheckObjFunction(obj,
53 {0, 0.1f, 0.9f, 1, 0, 0.1f, 0.9f, 1},
54 {0, 0, 0, 0, 1, 1, 1, 1},
55 {}, // empty weight
56 {0, 0.1f, 0.9f, 1.0f, -1.0f, -0.9f, -0.1f, 0},
57 {1, 1, 1, 1, 1, 1, 1, 1});
58 // clang-format on
59 ASSERT_NO_THROW({ [[maybe_unused]] auto _ = obj->DefaultEvalMetric(); });
60}
61
62void TestSquaredLog(const Context* ctx) {
63 std::string obj_name = "reg:squaredlogerror";

Callers 2

TESTFunction · 0.85
TESTFunction · 0.85

Calls 3

CheckObjFunctionFunction · 0.85
ConfigureMethod · 0.45
DefaultEvalMetricMethod · 0.45

Tested by

no test coverage detected