Extract the most "important" predictors for regression and classification models.

topPredictors(object, n = 1L, ...)

# S3 method for default
topPredictors(object, n = 1L, ...)

# S3 method for train
topPredictors(object, n = 1L, ...)

Arguments

object

A fitted model object of appropriate class (e.g., "gbm", "lm", "randomForest", etc.).

n

Integer specifying the number of predictors to return. Default is 1 meaning return the single most important predictor.

...

Additional optional arguments to be passed onto varImp.

Details

This function uses the generic function varImp to calculate variable importance scores for each predictor. After that, they are sorted at the names of the n highest scoring predictors are returned.

Examples