title: Getting features in RFECV scikit-learn
body: <p>Inspired by this: <a href="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" rel="noreferrer">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</a></p>
  
  <p>I am wondering if there is anyway to get the features for a particular score: </p>
  
  <p><a href="https://i.stack.imgur.com/ol5Ct.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ol5Ct.png" alt="enter image description here"></a></p>
  
  <p>In that case, I would like to know, which 10 features selected gives that peak when #Features = 10. </p>
  
  <p>Any ideas?</p>
  
  <p>EDIT: </p>
  
  <p>This is the code used to get that plot: </p>
  
  <pre><code>from sklearn.feature_selection import RFECV
  from sklearn.model_selection import KFold,StratifiedKFold #for K-fold cross validation
  from sklearn.ensemble import RandomForestClassifier #Random Forest
  
  # The "accuracy" scoring is proportional to the number of correct classifications
  #kfold = StratifiedKFold(n_splits=10, random_state=1) # k=10, split the data into 10 equal parts
  model_Linear_SVM=svm.SVC(kernel='linear', probability=True)
  rfecv = RFECV(estimator=model_Linear_SVM, step=1, cv=kfold,scoring='accuracy')   #5-fold cross-validation
  rfecv = rfecv.fit(X, y)
  
  print('Optimal number of features :', rfecv.n_features_)
  print('Best features :', X.columns[rfecv.support_])
  print('Original features :', X.columns)
  plt.figure()
  plt.xlabel("Number of features selected")
  plt.ylabel("Cross validation score \n of number of selected features")
  plt.plot(range(1, len(rfecv.grid_scores_) + 1), rfecv.grid_scores_)
  plt.show()
  </code></pre>