| 36 | } // namespace |
| 37 | |
| 38 | void 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 | |
| 62 | void TestSquaredLog(const Context* ctx) { |
| 63 | std::string obj_name = "reg:squaredlogerror"; |
no test coverage detected