After building a supervised learning model, we can estimate the importance of features. This estimation employs a sensitivity analysis to measure the effect on the output of a given model when the inputs are varied. In this recipe, we will show you how to rank the variable importance with the caret
package.
You need to have completed the previous recipe by storing the fitted rpart
object in the model
variable.
Perform the following steps to rank the variable importance with the caret
package:
- First, you can estimate the variable importance with the
varImp
function:
> importance = varImp(model, scale=FALSE) > importance Output rpart variable importance Overall number_customer_service_calls 116.015 total_day_minutes 106.988 total_day_charge 100.648 international_planyes 86.789 voice_mail_planyes ...