| 515 | } |
| 516 | |
| 517 | XGB_DLL int XGDMatrixCreateFromCSR(char const *indptr, char const *indices, char const *data, |
| 518 | xgboost::bst_ulong ncol, char const *c_json_config, |
| 519 | DMatrixHandle *out) { |
| 520 | API_BEGIN(); |
| 521 | xgboost_CHECK_C_ARG_PTR(indptr); |
| 522 | xgboost_CHECK_C_ARG_PTR(indices); |
| 523 | xgboost_CHECK_C_ARG_PTR(data); |
| 524 | data::CSRArrayAdapter adapter(StringView{indptr}, StringView{indices}, StringView{data}, ncol); |
| 525 | xgboost_CHECK_C_ARG_PTR(c_json_config); |
| 526 | auto config = Json::Load(StringView{c_json_config}); |
| 527 | float missing = GetMissing(config); |
| 528 | auto n_threads = OptionalArg<Integer, int64_t>(config, "nthread", 0); |
| 529 | auto data_split_mode = |
| 530 | static_cast<DataSplitMode>(OptionalArg<Integer, int64_t>(config, "data_split_mode", 0)); |
| 531 | xgboost_CHECK_C_ARG_PTR(out); |
| 532 | *out = new std::shared_ptr<DMatrix>( |
| 533 | DMatrix::Create(&adapter, missing, n_threads, "", data_split_mode)); |
| 534 | API_END(); |
| 535 | } |
| 536 | |
| 537 | XGB_DLL int XGDMatrixCreateFromDense(char const *data, char const *c_json_config, |
| 538 | DMatrixHandle *out) { |