| 13 | |
| 14 | namespace xgboost::tree { |
| 15 | inline std::shared_ptr<DMatrix> GenerateCatDMatrix(std::size_t rows, std::size_t cols, |
| 16 | float sparsity, bool categorical) { |
| 17 | if (categorical) { |
| 18 | std::vector<FeatureType> ft(cols); |
| 19 | for (size_t i = 0; i < ft.size(); ++i) { |
| 20 | ft[i] = (i % 3 == 0) ? FeatureType::kNumerical : FeatureType::kCategorical; |
| 21 | } |
| 22 | return RandomDataGenerator(rows, cols, sparsity) |
| 23 | .Seed(3) |
| 24 | .Type(ft) |
| 25 | .MaxCategory(17) |
| 26 | .GenerateDMatrix(); |
| 27 | } else { |
| 28 | return RandomDataGenerator{rows, cols, sparsity}.Seed(3).GenerateDMatrix(); |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | void TestColumnSplit(bst_target_t n_targets, bool categorical, std::string name, float sparsity); |
| 33 | } // namespace xgboost::tree |
no test coverage detected