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

Function GetModelWithArgs

tests/cpp/test_learner.cc:714–727  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

712
713namespace {
714Json GetModelWithArgs(std::shared_ptr<DMatrix> dmat, std::string const& tree_method,
715 std::string const& device, Args const& args) {
716 std::unique_ptr<Learner> learner{Learner::Create({dmat})};
717 auto n_threads = collective::GetWorkerLocalThreads(collective::GetWorldSize());
718 learner->SetParam("tree_method", tree_method);
719 learner->SetParam("device", device);
720 learner->SetParam("nthread", std::to_string(n_threads));
721 learner->SetParam("objective", "reg:logistic");
722 learner->SetParams(args);
723 learner->UpdateOneIter(0, dmat);
724 Json model{Object{}};
725 learner->SaveModel(&model);
726 return model;
727}
728
729void VerifyColumnSplitWithArgs(std::string const& tree_method, bool use_gpu, Args const& args,
730 Json const& expected_model) {

Callers 2

TestColumnSplitWithArgsFunction · 0.85

Calls 6

GetWorkerLocalThreadsFunction · 0.85
GetWorldSizeFunction · 0.85
SetParamMethod · 0.80
SetParamsMethod · 0.80
UpdateOneIterMethod · 0.80
SaveModelMethod · 0.45

Tested by

no test coverage detected