caret (version 4.87)

predictors: List predictors used in the model

Description

This class uses a model fit to determine which predictors were used in the final model.

Usage

predictors(x, ...)

## S3 method for class 'bagEarth': predictors(x, ...)

## S3 method for class 'bagFDA': predictors(x, ...)

## S3 method for class 'BinaryTree': predictors(x, surrogate = TRUE, ...)

## S3 method for class 'blackboost': predictors(x, ...)

## S3 method for class 'classbagg': predictors(x, surrogate = TRUE, ...)

## S3 method for class 'dsa': predictors(x, cuts = NULL, ...)

## S3 method for class 'earth': predictors(x, ...)

## S3 method for class 'fda': predictors(x, ...)

## S3 method for class 'foba': predictors(x, k = NULL, ...)

## S3 method for class 'formula': predictors(x, ...)

## S3 method for class 'gam': predictors(x, ...)

## S3 method for class 'gamboost': predictors(x, ...)

## S3 method for class 'gausspr': predictors(x, ...)

## S3 method for class 'gbm': predictors(x, ...)

## S3 method for class 'glm': predictors(x, ...)

## S3 method for class 'glmboost': predictors(x, ...)

## S3 method for class 'glmnet': predictors(x, lambda = NULL, ...)

## S3 method for class 'gpls': predictors(x, ...)

## S3 method for class 'knn3': predictors(x, ...)

## S3 method for class 'knnreg': predictors(x, ...)

## S3 method for class 'ksvm': predictors(x, ...)

## S3 method for class 'lars': predictors(x, s = NULL, ...)

## S3 method for class 'lda': predictors(x, ...)

## S3 method for class 'list': predictors(x, ...)

## S3 method for class 'lm': predictors(x, ...)

## S3 method for class 'logforest': predictors(x, ...)

## S3 method for class 'logicBagg': predictors(x, ...)

## S3 method for class 'LogitBoost': predictors(x, ...)

## S3 method for class 'logreg': predictors(x, ...)

## S3 method for class 'lssvm': predictors(x, ...)

## S3 method for class 'mda': predictors(x, ...)

## S3 method for class 'multinom': predictors(x, ...)

## S3 method for class 'mvr': predictors(x, ...)

## S3 method for class 'NaiveBayes': predictors(x, ...)

## S3 method for class 'nnet': predictors(x, ...)

## S3 method for class 'pamrtrained': predictors(x, newdata = NULL, threshold = NULL, ...)

## S3 method for class 'pcaNNet': predictors(x, ...)

## S3 method for class 'penfit': predictors(x, ...)

## S3 method for class 'ppr': predictors(x, ...)

## S3 method for class 'qda': predictors(x, ...)

## S3 method for class 'randomForest': predictors(x, ...)

## S3 method for class 'RandomForest': predictors(x, ...)

## S3 method for class 'rda': predictors(x, ...)

## S3 method for class 'regbagg': predictors(x, surrogate = TRUE, ...)

## S3 method for class 'rfe': predictors(x, ...)

## S3 method for class 'rpart': predictors(x, surrogate = TRUE, ...)

## S3 method for class 'rvm': predictors(x, ...)

## S3 method for class 'sbf': predictors(x, ...)

## S3 method for class 'sda': predictors(x, ...)

## S3 method for class 'slda': predictors(x, ...)

## S3 method for class 'smda': predictors(x, ...)

## S3 method for class 'spls': predictors(x, ...)

## S3 method for class 'splsda': predictors(x, ...)

## S3 method for class 'superpc': predictors(x, newdata = NULL, threshold = NULL, n.components = NULL, ...)

## S3 method for class 'terms': predictors(x, ...)

## S3 method for class 'train': predictors(x, ...)

## S3 method for class 'trocc': predictors(x, ...)

## S3 method for class 'Weka_classifier': predictors(x, ...)

Arguments

x
a model object, list or terms
newdata
for pamr.train and superpc.train: the training data
threshold
for pamr.train and superpc.train: the feature selection threshold
n.components
for superpc.train: the number of PCA components used
surrogate
a logical for rpart, ipredbagg, ctree and c
lambda
for glmnet: the L1 regularization value
s
for lars: the path index. See predict.lars
k
for foba: the sparsity level (i.e. the number of selected terms for the model). See predict.foba
cuts
the number of rule sets to use in the model (for partDSA only)
...
not currently used

Value

  • a character string of predictors or NA.

Details

For randomForest, cforest, ctree, rpart, ipredbagg, bagging, earth, fda, pamr.train, superpc.train, bagEarth and bagFDA, an attempt was made to report the predictors that were actually used in the final model.

In cases where the predictors cannot be determined, NA is returned. For example, nnet may return missing values from predictors.