| 669 | |
| 670 | public: |
| 671 | void Run(std::string objective) { |
| 672 | std::shared_ptr<DMatrix> p_fmat = MakeFmatForObjTest(objective, 10, 10, 3); |
| 673 | std::unique_ptr<Learner> learner{Learner::Create({p_fmat})}; |
| 674 | learner->SetParam("tree_method", "approx"); |
| 675 | learner->SetParam("objective", objective); |
| 676 | if (objective.find("quantile") != std::string::npos) { |
| 677 | learner->SetParam("quantile_alpha", "0.5"); |
| 678 | } |
| 679 | if (objective.find("expectile") != std::string::npos) { |
| 680 | learner->SetParam("expectile_alpha", "0.5"); |
| 681 | } |
| 682 | if (objective.find("multi") != std::string::npos) { |
| 683 | learner->SetParam("num_class", "3"); |
| 684 | } |
| 685 | learner->UpdateOneIter(0, p_fmat); |
| 686 | |
| 687 | Json config{Object{}}; |
| 688 | learner->SaveConfig(&config); |
| 689 | |
| 690 | Json model{Object{}}; |
| 691 | learner->SaveModel(&model); |
| 692 | |
| 693 | auto constexpr kWorldSize{3}; |
| 694 | auto call = [this, &objective](auto&... args) { |
| 695 | this->TestBaseScore(objective, args...); |
| 696 | }; |
| 697 | auto score = GetBaseScore(config); |
| 698 | collective::TestDistributedGlobal(kWorldSize, [&] { call(score, model); }); |
| 699 | } |
| 700 | }; |
| 701 | |
| 702 | TEST_P(TestColumnSplit, Objective) { |
no test coverage detected