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

Method SetUp

tests/cpp/test_serialization.cc:533–551  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

531class LogitSerializationTest : public SerializationTest {
532 protected:
533 void SetUp() override {
534 p_dmat_ = RandomDataGenerator(kRows, kCols, .5f).GenerateDMatrix();
535
536 std::shared_ptr<DMatrix> p_dmat{p_dmat_};
537 p_dmat->Info().labels.Reshape(kRows);
538 auto& h_labels = p_dmat->Info().labels.Data()->HostVector();
539
540 std::bernoulli_distribution flip(0.5);
541 std::mt19937 rnd{0};
542
543 for (auto& v : h_labels) {
544 v = flip(rnd);
545 }
546
547 for (size_t i = 0; i < kCols; ++i) {
548 std::string name = "feat_" + std::to_string(i);
549 fmap_.PushBack(i, name.c_str(), "q");
550 }
551 }
552};
553
554TEST_F(LogitSerializationTest, Exact) {

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