r random forest error - type of predictors in new data do not match

前端 未结 8 1424
挽巷
挽巷 2020-12-04 14:37

I am trying to use quantile regression forest function in R (quantregForest) which is built on Random Forest package. I am getting a type mismatch error that I can\'t quite

8条回答
  •  南笙
    南笙 (楼主)
    2020-12-04 15:28

    I had the same problem. You can try to use small trick to equalize classes of training and test set. Bind the first row of training set to the test set and than delete it. For your example it should look like this:

        xtest <- rbind(xtrain[1, ] , xtest)
        xtest <- xtest[-1,]
    

提交回复
热议问题