Recursive Feature Elimination. This algorithm implements backwards selection of predictors based on predictor importance ranking. The predictors are ranked and the less important ones are sequentially eliminated prior to modelling. The goal is to find a subset of predictors that can be used to produce an accurate model.
Questions tagged [rfe]
161 questions
10
votes
1 answer
Getting features in RFECV scikit-learn
Inspired by this: http://scikit-learn.org/stable/auto_examples/feature_selection/plot_rfe_with_cross_validation.html#sphx-glr-auto-examples-feature-selection-plot-rfe-with-cross-validation-py
I am wondering if there is anyway to get the features for…

Javiss
- 765
- 3
- 10
- 24
9
votes
1 answer
R caret / How does cross-validation for train within rfe work
I have a question regarding the rfe function from the caret library. On the caret-homepage link they give the following RFE algorithm:
algorithm
For this example I am using the rfe function with 3-fold cross-validation and the train function with a…

Fabian_G
- 431
- 4
- 16
7
votes
1 answer
Feature Selection in caret rfe + sum with ROC
I have been trying to apply recursive feature selection using caret package. What I need is that ref uses the AUC as performance measure. After googling for a month I cannot get the process working. Here is the code I have…

José Palma
- 71
- 1
- 3
6
votes
1 answer
How can I speed up Recursive Feature Elimination on 6,100,000 Features?
I am trying to obtain a ranking of features from a rather large set of features (~6,100,000) in sklearn. Here's the code I have thus far:
train, test = train_test_split(rows, test_size=0.2, random_state=310)
train, val = train_test_split(train,…

Joe B
- 912
- 2
- 15
- 36
5
votes
2 answers
Target transformation and feature selection in scikit-learn
I am using RFECV for feature selection in scikit-learn. I would like to compare the result of a simple linear model (X,y) with that of a log transformed model (using X, log(y))
Simple Model:
RFECV and cross_val_score provide the same result (we…

towi_parallelism
- 1,421
- 1
- 16
- 38
5
votes
1 answer
Doing hyperparameter estimation for the estimator in each fold of Recursive Feature Elimination
I am using sklearn to carry out recursive feature elimination with cross-validation, using the RFECV module. RFE involves repeatedly training an estimator on the full set of features, then removing the least informative features, until converging on…

user3140106
- 347
- 4
- 16
5
votes
1 answer
ValueError using recursive feature elimination for SVM with rbf kernel in scikit-learn
I'm trying to use the recursive feature elimination (RFE) function in scikit-learn but keep getting the error ValueError: coef_ is only available when using a linear kernel. I am trying to perform feature selection for a support vector classifier…

DavidS
- 2,344
- 1
- 17
- 18
5
votes
1 answer
R package, Caret RFE function, how to customize metric to use AUC?
I want to use AUC as the performance measure, but RFE only support RMSE, RSquared, Accuracy, Kappa. How can I use a customized metric such as auc?

user2684099
- 53
- 1
- 3
4
votes
0 answers
Using a Pipeline containing ColumnTransformer in SciKit's RFECV
I'm trying to do RFECV on the transformed data using SciKit.
For that, I create a pipeline and pass the pipeline to the RFECV. It works fine unless I have ColumnTransformer as a pipeline step. It gives me the following error:
ValueError: Specifying…

towi_parallelism
- 1,421
- 1
- 16
- 38
4
votes
1 answer
Using sklearn RFE with an estimator from another package
Is it possible to use sklearn Recursive Feature Elimination(RFE) with an estimator from another package?
Specifically, I want to use GLM from statsmodels package and wrap it in sklearn RFE?
If yes, could you please give some examples?

azuber
- 389
- 4
- 12
4
votes
1 answer
Recursive Feature Elimination on Categorical Data in sklearn?
I have a dataset containing 8 Parameters (4 Continuous 4 Categorical) and I am trying to eliminate features as per RFEC class in Scikit.
This is the formula I am using:
svc = SVC(kernel="linear")
rfecv = RFECV(estimator=svc, step=1,…

Hitesh
- 43
- 1
- 4
4
votes
1 answer
R Caret's rfe [Error in { : task 1 failed - "rfe is expecting 184 importance values but only has 2"]
I am using Caret's rfe for a regression application. My data (in data.table) has 176 predictors (including 49 factor predictors). When I run the function, I get this error:
Error in { : task 1 failed - "rfe is expecting 176 importance values but…

howaj
- 685
- 5
- 10
3
votes
2 answers
Is it possible to do feature selection within the Keras deep learning framework?
I know most people perform feature selection running RFE on a linear regression model, for example, BEFORE training the model with Keras.
However is it possible to do it within the training procedure of the deep neural network? If so how? Are there…

Caterina
- 775
- 9
- 26
3
votes
2 answers
Subscript out of bounds error in caret's rfe function
I am trying to use Caret's rfe function to do feature selection. My code worked not even a few days ago. Now I am getting a subscript of of bounds error. The weird part is I can run the rfe function with some built in data from another package no…

Bobby Davis
- 31
- 2
3
votes
1 answer
How does cross-validated recursive feature elimination drop features in each iteration (sklearn RFECV)?
I am using sklearn.feature_selection.RFECV to reduce the number of features in my final model. With non-cross-validated RFE, you can choose exactly how many features to select. However, with RFECV, you can only specify min_number_features_to_select,…

Arturo Sbr
- 5,567
- 4
- 38
- 76