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

Method SetUp

tests/cpp/test_serialization.cc:302–319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

300 protected:
301 ~SerializationTest() override = default;
302 void SetUp() override {
303 p_dmat_ = RandomDataGenerator(kRows, kCols, .5f).GenerateDMatrix();
304
305 p_dmat_->Info().labels.Reshape(kRows);
306 auto& h_labels = p_dmat_->Info().labels.Data()->HostVector();
307
308 xgboost::SimpleLCG gen(0);
309 SimpleRealUniformDistribution<float> dis(0.0f, 1.0f);
310
311 for (auto& v : h_labels) {
312 v = dis(&gen);
313 }
314
315 for (size_t i = 0; i < kCols; ++i) {
316 std::string name = "feat_" + std::to_string(i);
317 fmap_.PushBack(i, name.c_str(), "q");
318 }
319 }
320};
321
322size_t constexpr SerializationTest::kRows;

Callers

nothing calls this directly

Calls 7

RandomDataGeneratorClass · 0.85
GenerateDMatrixMethod · 0.80
ReshapeMethod · 0.80
PushBackMethod · 0.80
c_strMethod · 0.80
InfoMethod · 0.45
DataMethod · 0.45

Tested by

no test coverage detected