Besides using the caret
package to generate variable importance, you can use the rminer
package to generate the variable importance of a classification model. In the following recipe, we will illustrate how to use rminer
to obtain the variable importance of a fitted model.
In this recipe, we will continue to use the telecom churn
dataset as the input data source to rank the variable importance.
Perform the following steps to rank the variable importance with rminer
:
- Install and load the package,
rminer
:
> install.packages("rminer") > library(rminer)
- Fit the svm model with the training set:
> model=fit(churn~.,trainset,model="svm")
- Use the
Importance
function to obtain the variable importance:
> VariableImportance=Importance(model,trainset,method="sensv")
- Plot the variable importance ranked by the variance:
> L=list(runs=1,sen=t(VariableImportance$imp...