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

Method Run

tests/cpp/test_learner.cc:671–699  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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
702TEST_P(TestColumnSplit, Objective) {

Callers 1

TEST_PFunction · 0.45

Calls 9

TestBaseScoreMethod · 0.95
MakeFmatForObjTestFunction · 0.85
GetBaseScoreFunction · 0.85
TestDistributedGlobalFunction · 0.85
SetParamMethod · 0.80
UpdateOneIterMethod · 0.80
callFunction · 0.50
SaveConfigMethod · 0.45
SaveModelMethod · 0.45

Tested by

no test coverage detected