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

Method RunTest

tests/cpp/tree/test_prediction_cache.h:66–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64 }
65
66 void RunTest(Context* ctx, std::string const& updater_name, std::string const& strategy) {
67 {
68 ctx->InitAllowUnknown(Args{{"nthread", "8"}});
69
70 ObjInfo task{ObjInfo::kRegression};
71 std::unique_ptr<TreeUpdater> updater{TreeUpdater::Create(updater_name, ctx, &task)};
72 RegTree tree;
73 std::vector<RegTree*> trees{&tree};
74 auto gpair = GenerateRandomGradients(ctx, n_samples_, 1);
75 tree::TrainParam param;
76 param.UpdateAllowUnknown(Args{{"max_bin", "64"}});
77
78 updater->Configure(Args{});
79 std::vector<HostDeviceVector<bst_node_t>> position(1);
80 updater->Update(&param, &gpair, Xy_.get(), position, trees);
81 HostDeviceVector<float> out_prediction_cached;
82 out_prediction_cached.SetDevice(ctx->Device());
83 out_prediction_cached.Resize(n_samples_);
84 auto cache =
85 linalg::MakeTensorView(ctx, &out_prediction_cached, out_prediction_cached.Size(), 1);
86 ASSERT_TRUE(updater->UpdatePredictionCache(Xy_.get(), common::Span{position}, cache));
87 }
88
89 for (auto policy : {"depthwise", "lossguide"}) {
90 for (auto subsample : {1.0f, 0.4f}) {
91 this->RunLearnerTest(ctx, updater_name, subsample, policy, strategy);
92 this->RunLearnerTest(ctx, updater_name, subsample, policy, strategy);
93 }
94 }
95 }
96};
97} // namespace xgboost

Callers

nothing calls this directly

Calls 12

RunLearnerTestMethod · 0.95
GenerateRandomGradientsFunction · 0.85
MakeTensorViewFunction · 0.85
UpdateAllowUnknownMethod · 0.45
ConfigureMethod · 0.45
UpdateMethod · 0.45
getMethod · 0.45
SetDeviceMethod · 0.45
DeviceMethod · 0.45
ResizeMethod · 0.45
SizeMethod · 0.45
UpdatePredictionCacheMethod · 0.45

Tested by

no test coverage detected