I have fit my gradient boosting model and am trying to print variable importance. I have used the same code and works using random forest. I keep getting the error when running varImp()
. The error is the following.
Error in code$varImp(object$finalModel, ...) : could not find function "relative.influence"
#Split into testing and training
set.seed(7)
Data_Splitting <- createDataPartition(clean_data$Output,p=2/3,list=FALSE)
training = clean_data[Data_Splitting,]
testing = clean_data[-Data_Splitting,]
#Random Forest training part
set.seed(7)
gbm_train <- train(Output~., data=training, method = "gbm",
trControl = trainControl(method="cv", number=4, classProbs = T, summaryFunction = twoClassSummary), metric="ROC")
#Plot of variable importance
varImp(gbm_train)
summary.gbm(gbm_train)
plot(varImp(gbm_train))
print(gbm)
#Random Forest Testing phase
gbm_predict = predict(gbm_train,newdata=testing,type="prob")