| 535 | } |
| 536 | |
| 537 | XGB_DLL int XGDMatrixCreateFromDense(char const *data, char const *c_json_config, |
| 538 | DMatrixHandle *out) { |
| 539 | API_BEGIN(); |
| 540 | xgboost_CHECK_C_ARG_PTR(data); |
| 541 | xgboost::data::ArrayAdapter adapter{xgboost::data::ArrayAdapter(StringView{data})}; |
| 542 | xgboost_CHECK_C_ARG_PTR(c_json_config); |
| 543 | auto config = Json::Load(StringView{c_json_config}); |
| 544 | float missing = GetMissing(config); |
| 545 | auto n_threads = OptionalArg<Integer, int64_t>(config, "nthread", 0); |
| 546 | auto data_split_mode = |
| 547 | static_cast<DataSplitMode>(OptionalArg<Integer, int64_t>(config, "data_split_mode", 0)); |
| 548 | xgboost_CHECK_C_ARG_PTR(out); |
| 549 | *out = new std::shared_ptr<DMatrix>( |
| 550 | DMatrix::Create(&adapter, missing, n_threads, "", data_split_mode)); |
| 551 | API_END(); |
| 552 | } |
| 553 | |
| 554 | XGB_DLL int XGDMatrixCreateFromCSC(char const *indptr, char const *indices, char const *data, |
| 555 | xgboost::bst_ulong nrow, char const *c_json_config, |