chen
chen

Reputation: 69

R Caret Calculate RMSE for Testing Set

I am wondering how can I calculate RMSE for the Testing Set.

I used the code below to train the model:

model_gbm_important<-train(trainSetSmall[,predictors_gbm],trainSetSmall[,outcomeName],method='gbm', trControl=fitControl)

I can get the performance of the model by using

print(model_gbm_important)

However, this performance is based on the cross-validation. If I have another testing set, how can I use testing set to evaluate the model, lick check the value of RMSE?

Thanks!

Upvotes: 0

Views: 4783

Answers (1)

kangaroo_cliff
kangaroo_cliff

Reputation: 6222

To calculate RMSE of prediction of test data:

predictions <- predict(model, test_data)
RMSE(predictions, test_data$outcomeName)

Upvotes: 3

Related Questions