Reputation: 69
I got a problem while using Caret
.
I used the following code to build model in nnet method, it works.
model_nnet<-train(trainSetSmall[,predictors],trainSetSmall[,outcomeName],method='nnet')
importance <- varImp(model_nnet, scale=FALSE)
plot(importance)
Then, I want to try other models. I tried "gbm", but it does not work.
model_gbm<-train(trainSetSmall[,predictors],trainSetSmall[,outcomeName],method='gbm')
importance2 <- varImp(model_gbm, scale=FALSE)
Error Message: > importance2 <- varImp(model_gbm, scale=FALSE)
Error in relative.influence(object, n.trees = numTrees) :
could not find function "relative.influence"
I tried others models also, but except nnet, I canot find another worked one. Sample of My Data (All columns are numeric):
structure(list(x_NMI = c(6347, 6347), EstimateReadBitmaskInd = c(0,
0), MeterRegActiveReadingDt = c("15-01-2013", "18-01-2013"),
MtrRegActNetEngyDailyKwh = c(16.736, 18.093), MtrRgActNetEngyMaxdlyKwh = c(0.831,
0.65), RegisterId = c(2, 2), RegisterType = c(2, 2), Building = c(6,
6), numberofpeople = c(5, 5), pool = c(2, 2), typeofAC = c(1,
1), NoOfAc = c(1, 1)), row.names = 1:2, class = "data.frame")
Upvotes: 1
Views: 508
Reputation: 323
Looks like relative.influence
is a function in the package gbm
as can be seen here:
relative.influence documentation
I installed caret and tried to train a model on some trivial data using gbm. This message prompted me to install the gbm
package.
Once I installed the gbm
package, I was able to train models using gbm in caret.
Upvotes: 1