Search code examples
xgboost

What are the possible feature types in xgboost?


On the documentation page for xgboost for python we see a feature_types https://xgboost.readthedocs.io/en/latest/python/python_api.html parameters but have no idea what are the possible values.

The documentation is really bad.

What are the possible values for feature_types?


Solution

  • The documentation seems poor as you say, searching through the XGBoost source code on Github gives some tests that show these options:

    • int
    • float
    • q: quantitative
    • i: indicator

    While it is a bit difficult to figure out what these mean, some other sites list some additional information:

    Link: another StackOverflow post that mentions the q and i types.

    In XGBoosts core.py code you can also find a comment on types:

     # use quantitative as default
     # {'q': quantitative, 'i': indicator}
    

    Looking at the XGBoost code, from the rest of it, the type parsing goes into the underlying c-based backend code, so that is a bit of a black box still unless you want to go explore it.. :)