In a linear SVM model, inside
caret I would like to get the variable importance after recursive feature elimination, so according to the documentation:
library(caret) library(mlbench) library(Hmisc) library(randomForest) n <- 100 p <- 40 sigma <- 1 set.seed(1) sim <- mlbench.friedman1(n, sd = sigma) colnames(sim$x) <- c(paste("real", 1:5, sep = ""), paste("bogus", 1:5, sep = "")) bogus <- matrix(rnorm(n * p), nrow = n) colnames(bogus) <- paste("bogus", 5+(1:ncol(bogus)), sep = "") x <- cbind(sim$x, bogus) y <- sim$y normalization <- preProcess(x) x <- predict(normalization, x) x <- as.data.frame(x) subsets <- c(1:5, 10, 15, 20, 25) set.seed(10) ctrl <- rfeControl(functions = caretFuncs, method = "repeatedcv", repeats = 5, verbose = FALSE) lmProfile <- rfe(x, y, sizes = subsets, rfeControl = ctrl) lmProfile
The output of
lmProfile shows the most 5 important variables, and
predictors(lmProfile) will show me all the important (retained) predictors after recursive feature elimination. In the documentation I can read this sentence:
... At first this may seem like a disadvantage, but it does provide a more probabilistic assessment of predictor importance than a ranking based on a single fixed data set. At the end of the algorithm, a consensus ranking can be used to determine the best predictors to retain.
Could anyone please let me know how I can get these probabilistic numbers for each retained variable? In other words I would like to report my important variables not only by showing their ranks, but in a more quantitative way.