MCPcopy Create free account
hub / github.com/antmachineintelligence/mtgbmcode / LGBM_BoosterPredictForCSR

Function LGBM_BoosterPredictForCSR

src/c_api.cpp:1352–1384  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1350}
1351
1352int LGBM_BoosterPredictForCSR(BoosterHandle handle,
1353 const void* indptr,
1354 int indptr_type,
1355 const int32_t* indices,
1356 const void* data,
1357 int data_type,
1358 int64_t nindptr,
1359 int64_t nelem,
1360 int64_t num_col,
1361 int predict_type,
1362 int num_iteration,
1363 const char* parameter,
1364 int64_t* out_len,
1365 double* out_result) {
1366 API_BEGIN();
1367 if (num_col <= 0) {
1368 Log::Fatal("The number of columns should be greater than zero.");
1369 } else if (num_col >= INT32_MAX) {
1370 Log::Fatal("The number of columns should be smaller than INT32_MAX.");
1371 }
1372 auto param = Config::Str2Map(parameter);
1373 Config config;
1374 config.Set(param);
1375 if (config.num_threads > 0) {
1376 omp_set_num_threads(config.num_threads);
1377 }
1378 Booster* ref_booster = reinterpret_cast<Booster*>(handle);
1379 auto get_row_fun = RowFunctionFromCSR(indptr, indptr_type, indices, data, data_type, nindptr, nelem);
1380 int nrow = static_cast<int>(nindptr - 1);
1381 ref_booster->Predict(num_iteration, predict_type, nrow, static_cast<int>(num_col), get_row_fun,
1382 config, out_result, out_len);
1383 API_END();
1384}
1385
1386int LGBM_BoosterPredictForCSRSingleRow(BoosterHandle handle,
1387 const void* indptr,

Callers

nothing calls this directly

Calls 4

RowFunctionFromCSRFunction · 0.70
omp_set_num_threadsFunction · 0.50
SetMethod · 0.45
PredictMethod · 0.45

Tested by

no test coverage detected