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

Function TestOrdinalEncoderEmpty

tests/cpp/encoder/test_ordinal.h:179–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177
178template <typename Encoder, typename DfTest>
179void TestOrdinalEncoderEmpty() {
180 auto sol = std::vector<std::int32_t>{0, 3, 1};
181 Encoder encoder;
182 auto df = DfTest::Make(DfTest::MakeInts(), DfTest::MakeStrs("cbd", "bbd", "dbd", "ab"),
183 DfTest::MakeInts());
184 auto orig_dict = df.View();
185
186 auto new_df =
187 DfTest::Make(DfTest::MakeInts(), DfTest::MakeStrs("cbd", "ab", "bbd"), DfTest::MakeInts());
188 auto new_dict = new_df.View();
189 encoder.Recode(orig_dict, new_dict, new_df.MappingView());
190 ASSERT_EQ(new_df.Mapping().size(), 3);
191 ASSERT_EQ(new_df.Mapping(), sol);
192}
193} // namespace enc

Callers

nothing calls this directly

Calls 4

RecodeMethod · 0.80
MappingViewMethod · 0.80
ViewMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected