Add XGBoosterGetNumFeature (#5856)
- add GetNumFeature to Learner - add XGBoosterGetNumFeature to C API - update c-api-demo accordingly
This commit is contained in:
@@ -563,6 +563,14 @@ XGB_DLL int XGBoosterSetParam(BoosterHandle handle,
|
||||
const char *name,
|
||||
const char *value);
|
||||
|
||||
/*!
|
||||
* \brief get number of features
|
||||
* \param out number of features
|
||||
* \return 0 when success, -1 when failure happens
|
||||
*/
|
||||
XGB_DLL int XGBoosterGetNumFeature(BoosterHandle handle,
|
||||
bst_ulong *out);
|
||||
|
||||
/*!
|
||||
* \brief update the model in one round using dtrain
|
||||
* \param handle handle
|
||||
|
||||
@@ -158,6 +158,12 @@ class Learner : public Model, public Configurable, public rabit::Serializable {
|
||||
*/
|
||||
virtual void SetParam(const std::string& key, const std::string& value) = 0;
|
||||
|
||||
/*!
|
||||
* \brief Get the number of features of the booster.
|
||||
* \return number of features
|
||||
*/
|
||||
virtual uint32_t GetNumFeature() = 0;
|
||||
|
||||
/*!
|
||||
* \brief Set additional attribute to the Booster.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user