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

Function GBTreeModelForTest

tests/cpp/predictor/test_predictor.cc:374–389  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

372}
373
374void GBTreeModelForTest(gbm::GBTreeModel *model, uint32_t split_ind, bst_cat_t split_cat,
375 float left_weight, float right_weight) {
376 PredictionCacheEntry out_predictions;
377
378 std::vector<std::unique_ptr<RegTree>> trees;
379 trees.push_back(std::unique_ptr<RegTree>(new RegTree));
380 auto &p_tree = trees.front();
381
382 std::vector<uint32_t> split_cats(LBitField32::ComputeStorageSize(split_cat));
383 LBitField32 cats_bits(split_cats);
384 cats_bits.Set(split_cat);
385
386 p_tree->ExpandCategorical(0, split_ind, split_cats, true, 1.5f, left_weight, right_weight, 3.0f,
387 2.2f, 7.0f, 9.0f);
388 model->CommitModelGroup(std::move(trees), 0);
389}
390
391void TestCategoricalPrediction(bool use_gpu, bool is_column_split) {
392 Context ctx;

Callers 2

Calls 3

ExpandCategoricalMethod · 0.80
CommitModelGroupMethod · 0.80
SetMethod · 0.45

Tested by

no test coverage detected