rfe

Doing hyperparameter estimation for the estimator in each fold of Recursive Feature Elimination

筅森魡賤 提交于 2020-01-13 10:22:23
问题 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 the optimal number of features. In order to obtain optimal performance by the estimator, I want to select the best hyperparameters for the estimator for each number of features (edited for clarity). The estimator is a linear SVM so I am only

Doing hyperparameter estimation for the estimator in each fold of Recursive Feature Elimination

荒凉一梦 提交于 2020-01-13 10:21:54
问题 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 the optimal number of features. In order to obtain optimal performance by the estimator, I want to select the best hyperparameters for the estimator for each number of features (edited for clarity). The estimator is a linear SVM so I am only

Feature selection with caret rfe and training with another method

随声附和 提交于 2020-01-13 06:41:47
问题 Right now, I'm trying to use Caret rfe function to perform the feature selection, because I'm in a situation with p>>n and most regression techniques that don't involve some sort of regularisation can't be used well. I already used a few techniques with regularisation (Lasso), but what I want to try now is reduce my number of feature so that I'm able to run, at least decently, any kind of regression algorithm on it. control <- rfeControl(functions=rfFuncs, method="cv", number=5) model <- rfe

Feature selection with caret rfe and training with another method

╄→гoц情女王★ 提交于 2020-01-13 06:41:09
问题 Right now, I'm trying to use Caret rfe function to perform the feature selection, because I'm in a situation with p>>n and most regression techniques that don't involve some sort of regularisation can't be used well. I already used a few techniques with regularisation (Lasso), but what I want to try now is reduce my number of feature so that I'm able to run, at least decently, any kind of regression algorithm on it. control <- rfeControl(functions=rfFuncs, method="cv", number=5) model <- rfe

Using sklearn RFE with an estimator from another package

狂风中的少年 提交于 2020-01-04 03:55:47
问题 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? 回答1: Yes, it is possible. You just need to create a class that inherit sklearn.base.BaseEstimator , make sure it has fit & predict methods, and make sure its fit method expose feature importance through either coef_ or feature_importances_ attribute. Here is a

R using my own model in RFE(recursive feature elimination) to pick important feature

落花浮王杯 提交于 2019-12-13 21:01:13
问题 Using RFE, you can get a importance rank of the features, but right now I can only use the model and parameter inner the package like: lmFuncs(linear model),rfFuncs(random forest) it seems that caretFuncs can do some custom settings for your own model and parameter,but I don't know the details and the formal document didn't give detail, I want to apply svm and gbm to this RFE process,because this is the current model I used to train, anyone has any idea? 回答1: I tried to recreate working

Getting features in RFECV scikit-learn

百般思念 提交于 2019-12-11 01:56:10
问题 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 a particular score: In that case, I would like to know, which 10 features selected gives that peak when #Features = 10. Any ideas? EDIT: This is the code used to get that plot: from sklearn.feature_selection import RFECV from sklearn.model

R Caret's rfe [Error in { : task 1 failed - “rfe is expecting 184 importance values but only has 2”]

江枫思渺然 提交于 2019-12-06 07:18:30
问题 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 only has 2" Then, I used model.matrix( ~ . - 1, data = as.data.frame(train_model_sell_single_bid)) to convert the factor predictors to dummy variables. However, I got similar error: Error in { : task 1 failed - "rfe is expecting 184 importance values

Doing hyperparameter estimation for the estimator in each fold of Recursive Feature Elimination

倾然丶 夕夏残阳落幕 提交于 2019-12-05 10:39:16
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 the optimal number of features. In order to obtain optimal performance by the estimator, I want to select the best hyperparameters for the estimator for each number of features (edited for clarity). The estimator is a linear SVM so I am only looking into the C parameter. Initially, my code was as follows. However, this just did one grid search for

Feature selection with caret rfe and training with another method

烈酒焚心 提交于 2019-12-04 20:19:31
Right now, I'm trying to use Caret rfe function to perform the feature selection, because I'm in a situation with p>>n and most regression techniques that don't involve some sort of regularisation can't be used well. I already used a few techniques with regularisation (Lasso), but what I want to try now is reduce my number of feature so that I'm able to run, at least decently, any kind of regression algorithm on it. control <- rfeControl(functions=rfFuncs, method="cv", number=5) model <- rfe(trainX, trainY, rfeControl=control) predict(model, testX) Right now, if I do it like this, a feature