Num_feature parameter usage in python package


I am trying to use XGBoostClassifier as part of the sklearn pipeline interface, and the latest version throws the following error:

xgboost.core.XGBoostError: b"Invalid Parameter format for num_feature expect int (non-negative) but value='sqrt'"

This happens when I use the range of values for num_feature to be

range_num_feature = ['sqrt', 0.25, reduced_dim]

it did work in prior version(s) when I first implemented it. Now the xgboost docs say [set automatically by XGBoost, no need to be set by user] , which appears to be a “soft” warning, but not a prohibition of use.

Any idea what’s going on? Should I stop using that parameter altogether, or only string spec is not allowed?


to clarify, range of values is used to build the parameter grid as part of GridSearchCV


It might be that this functionality has been moved to the colsample_by parameter, and as the error say, XGBoost expects an integer there.

I’ll add this to the list of things to be deprecated.