How to handle categorical variables in sklearn GradientBoostingClassifier?

前端 未结 2 914
孤城傲影
孤城傲影 2021-02-04 12:20

I am attempting to train models with GradientBoostingClassifier using categorical variables.

The following is a primitive code sample, just for trying to input categori

2条回答
  •  执笔经年
    2021-02-04 12:50

    Sure it can handle it, you just have to encode the categorical variables as a separate step on the pipeline. Sklearn is perfectly capable of handling categorical variables as well as R or any other ML package. The R package is still (presumably) doing one-hot encoding behind the scenes, it just doesn't separate the concerns of encoding and fitting in this case (as it arguably should).

提交回复
热议问题