| 55 | } |
| 56 | |
| 57 | void TestSoftprobMultiClassBasic(const Context* ctx) { |
| 58 | std::vector<std::pair<std::string, std::string>> args { |
| 59 | std::pair<std::string, std::string>("num_class", "3")}; |
| 60 | |
| 61 | std::unique_ptr<ObjFunction> obj { |
| 62 | ObjFunction::Create("multi:softprob", ctx) |
| 63 | }; |
| 64 | obj->Configure(args); |
| 65 | CheckConfigReload(obj, "multi:softprob"); |
| 66 | |
| 67 | HostDeviceVector<bst_float> io_preds = {2.0f, 0.0f, 1.0f}; |
| 68 | std::vector<bst_float> out_preds = {0.66524096f, 0.09003057f, 0.24472847f}; |
| 69 | |
| 70 | obj->PredTransform(&io_preds); |
| 71 | auto& preds = io_preds.HostVector(); |
| 72 | |
| 73 | for (int i = 0; i < static_cast<int>(io_preds.Size()); ++i) { |
| 74 | EXPECT_NEAR(preds[i], out_preds[i], 0.01f); |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | } // namespace xgboost |
no test coverage detected