title: How to use scikit's preprocessing/normalization along with cross validation?
body: <p>As an example of cross-validation without any preprocessing, I can do something like this:</p>
  
  <pre><code>    tuned_params = [{"penalty" : ["l2", "l1"]}]
      from sklearn.linear_model import SGDClassifier
      SGD = SGDClassifier()
      from sklearn.grid_search import GridSearchCV
      clf = GridSearchCV(myClassifier, params, verbose=5)
      clf.fit(x_train, y_train)
  </code></pre>
  
  <p>I would like to preprocess my data using something like </p>
  
  <pre><code>from sklearn import preprocessing
  x_scaled = preprocessing.scale(x_train)
  </code></pre>
  
  <p>But it would not be a good idea to do this before setting the cross validation, because then the training and testing sets will be normalized together. How do I setup the cross validation to preprocess the corresponding training and test sets separately on each run?</p>