Add XGBoosterGetNumFeature (#5856)

- add GetNumFeature to Learner
- add XGBoosterGetNumFeature to C API
- update c-api-demo accordingly
This commit is contained in:
Alexander Gugel
2020-07-14 07:25:17 +01:00
committed by GitHub
parent e0c179c7cc
commit 970b4b3fa2
6 changed files with 36 additions and 1 deletions

View File

@@ -395,6 +395,14 @@ XGB_DLL int XGBoosterSetParam(BoosterHandle handle,
API_END();
}
XGB_DLL int XGBoosterGetNumFeature(BoosterHandle handle,
xgboost::bst_ulong *out) {
API_BEGIN();
CHECK_HANDLE();
*out = static_cast<Learner*>(handle)->GetNumFeature();
API_END();
}
XGB_DLL int XGBoosterLoadJsonConfig(BoosterHandle handle, char const* json_parameters) {
API_BEGIN();
CHECK_HANDLE();