R xgboost on caret attempts to perform classification instead of regression

后端 未结 1 1995
面向向阳花
面向向阳花 2021-01-27 13:27

everyone.

first, data sample is here:

> str(train)
\'data.frame\':   30226 obs. of  71 variables:
 $ sal              : int  2732 2732 2732 2328 2560         


        
相关标签:
1条回答
  • 2021-01-27 14:05

    It's not strange that caret thinks you are asking for classification, because you are actually doing so in these 2 lines of your trainControl function:

    classProbs = TRUE,     
    summaryFunction = twoClassSummary
    

    Remove both these lines (so as they take their default values - see the function documentation), and you should be fine.

    Notice also that AUC is only applicable to classification problems.

    UPDATE (after comments): Seems that the target variable being integer causes the problem; convert it to double before running the model with

    train$sal <- as.double(train$sal)
    
    0 讨论(0)
提交回复
热议问题