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

Method Run

tests/cpp/tree/test_tree_stat.cc:301–324  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

299class TestRegularization : public ::testing::Test {
300 public:
301 void Run(Context const* ctx, std::string const& updater, std::string p, bst_target_t n_targets) {
302 bst_idx_t n_samples = 4096;
303 bst_feature_t n_features = 32;
304 auto p_fmat = RandomDataGenerator(n_samples, n_features, .0f)
305 .Seed(3)
306 .Targets(n_targets)
307 .GenerateDMatrix(true);
308 auto gpairs = GenerateRandomGradients(ctx, n_samples, n_targets);
309
310 RegTree tree_0{static_cast<bst_target_t>(gpairs.gpair.Shape(1)),
311 static_cast<bst_target_t>(p_fmat->Info().num_col_)};
312 BuildTree(ctx, p_fmat.get(), &gpairs, updater, Args{{p, "0.0"}}, &tree_0);
313 // not exact, just checking the tree can be built
314 if (n_targets > 1) {
315 ASSERT_GE(tree_0.NumNodes(), 40);
316 } else {
317 ASSERT_GE(tree_0.NumNodes(), 50);
318 }
319
320 RegTree tree_1{static_cast<bst_target_t>(gpairs.gpair.Shape(1)),
321 static_cast<bst_target_t>(p_fmat->Info().num_col_)};
322 BuildTree(ctx, p_fmat.get(), &gpairs, updater, Args{{p, "1024.0"}}, &tree_1);
323 ASSERT_EQ(tree_1.NumNodes(), 1);
324 }
325};
326
327class TestLambda : public TestRegularization {

Callers

nothing calls this directly

Calls 10

RandomDataGeneratorClass · 0.85
GenerateRandomGradientsFunction · 0.85
BuildTreeFunction · 0.85
GenerateDMatrixMethod · 0.80
SeedMethod · 0.80
ShapeMethod · 0.80
NumNodesMethod · 0.80
TargetsMethod · 0.45
InfoMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected