Error in train.default(x, y, weights = w, …) : final tuning parameters could not be determined

前端 未结 2 1367
滥情空心
滥情空心 2021-01-03 08:44

I am very new at machine learning and am attempting the forest cover prediction competition on Kaggle, but I am getting hung up pretty early on. I get the following error wh

2条回答
  •  一个人的身影
    2021-01-03 09:40

    The following should work:

    model1 <- train(as.factor(Cover_Type) ~ Elevation + Aspect + Slope + Horizontal_Distance_To_Hydrology,
                              data = data.train,
                              method = "rf", tuneGrid = data.frame(mtry = 3))
    

    Its always better to specify the tuneGrid parameter which is a data frame with possible tuning values. Look at ?randomForest and ?train for more information. rf has only one tuning parameter mtry, which controls the number of features selected for each tree.

    You can also run modelLookup to get a list of tuning parameters for each model

    > modelLookup("rf")
    #  model parameter                         label forReg forClass probModel
    #1    rf      mtry #Randomly Selected Predictors   TRUE     TRUE      TRUE
    

提交回复
热议问题