title: Scikit-learn - feature reduction using RFECV and GridSearch. Where are the coefficients stored?
body: <p>I am using Scikit-learn RFECV to select most significant features for a logistic regression using a Cross Validation.  Assume X is a [n,x] dataframe of features, and y represents the response variable:</p>
  
  <pre><code>from sklearn.pipeline import make_pipeline
  from sklearn.grid_search import GridSearchCV
  from sklearn.cross_validation import StratifiedKFold
  from sklearn import preprocessing
  from sklearn.feature_selection import RFECV
  import sklearn
  import sklearn.linear_model as lm
  import sklearn.grid_search as gs
  
  #  Create a logistic regression estimator 
  logreg = lm.LogisticRegression()
  
  # Use RFECV to pick best features, using Stratified Kfold
  rfecv =   RFECV(estimator=logreg, cv=StratifiedKFold(y, 3), scoring='roc_auc')
  
  # Fit the features to the response variable
  rfecv.fit(X, y)
  
  # Put the best features into new df X_new
  X_new = rfecv.transform(X)
  
  # 
  pipe = make_pipeline(preprocessing.StandardScaler(), lm.LogisticRegression())
  
  # Define a range of hyper parameters for grid search
  C_range = 10.**np.arange(-5, 1)
  penalty_options = ['l1', 'l2']
  
  skf = StratifiedKFold(y, 3)
  param_grid = dict(logisticregression__C=C_range,  logisticregression__penalty=penalty_options)
  
  grid = GridSearchCV(pipe, param_grid, cv=skf, scoring='roc_auc')
  
  grid.fit(X_new, y) 
  </code></pre>
  
  <p>Two questions: </p>
  
  <p>a) Is this the correct process for feature, hyper-parameter selection and fitting?</p>
  
  <p>b) Where can I find the fitted coefficients for the selected features?</p>