3

Im using the caret package in R to build a regression model using a Cubist model tree, which has two tuning parameters:

Tuning Parameters: committees (#Committees), neighbors (#Instances)

I think I am trying to implement the tuning parameters incorrectly and need some help to fix the issue. Following the examples on the caret site I have built a grid for my tuning parameters as follows:

cubistGrid <- expand.grid(committees = 30, neighbors = 10)

then Im calling the grid using the train function as follows:

LMFit1 <- train(Total~., data = training, method = "cubist", trControl = fitControl, tuneGrid = cubistGrid)

Im getting the following error:

Something is wrong; all the RMSE metric values are missing:

I dont have any issues with my dataframe as Ive run many models on it to date; this is the first time Ive used the tuning parameters.

Thanks,

Ben

phiver
  • 23,048
  • 14
  • 44
  • 56
DataGuy
  • 1,695
  • 4
  • 22
  • 38
  • The document by Max Kuhn on [Cubist Models For Regression](https://cran.r-project.org/web/packages/Cubist/vignettes/cubist.pdf) will be useful. – Ekaba Bisong Dec 06 '16 at 04:16

1 Answers1

4

First of all, not a reproducible example, but if you check the warnings you will see the following:

predictions failed for Resample1: committees=30, neighbors=10 Error in predict.cubist(modelFit, newdata, neighbors = modelFit$tuneValue$neighbors) : 'neighbors' must be less than 10

Set the neighbors to a value less than 10. That should take care of the empty rmse metrics.

Community
  • 1
  • 1
phiver
  • 23,048
  • 14
  • 44
  • 56
  • After a similar issue and ultimately reading the cubist documentation, neighbors must be an integer between 0 and 9. It would be good if the train function checked the inputs and reported this. – chepyle Nov 29 '16 at 02:59