Understanding num_classes for xgboost in R

后端 未结 4 1571
没有蜡笔的小新
没有蜡笔的小新 2021-01-17 10:11

I\'m having a lot of trouble figuring out how to correctly set the num_classes for xgboost.

I\'ve got an example using the Iris data

df <- iris

         


        
4条回答
  •  渐次进展
    2021-01-17 10:39

    I had this problem and it turned out that I was trying to subtract 1 from my predictor which was already in the units of 0 and 1. Probably a novice mistake, but in case anyone else is running into this with a binary response variable that is already 0 and 1 it is something to make note of.

    Tutorial said:

    label = as.integer(iris$Species)-1
    

    What worked for me (response is high_end):

    label = as.integer(high_end)
    

提交回复
热议问题