title: Fitting in nested cross-validation with cross_val_score with pipeline and GridSearch
body: <p>I am working in scikit and I am trying to tune my XGBoost.
  I made an attempt to use a nested cross-validation using the pipeline for the rescaling of the training folds (to avoid data leakage and overfitting) and in parallel with GridSearchCV for param tuning and cross_val_score to get the roc_auc score at the end.</p>
  
  <pre><code>from imblearn.pipeline import Pipeline 
  from sklearn.model_selection import RepeatedKFold 
  from sklearn.model_selection import GridSearchCV
  from sklearn.model_selection import cross_val_score
  from xgboost import XGBClassifier
  
  
  std_scaling = StandardScaler() 
  algo = XGBClassifier()
  
  steps = [('std_scaling', StandardScaler()), ('algo', XGBClassifier())]
  
  pipeline = Pipeline(steps)
  
  parameters = {'algo__min_child_weight': [1, 2],
                'algo__subsample': [0.6, 0.9],
                'algo__max_depth': [4, 6],
                'algo__gamma': [0.1, 0.2],
                'algo__learning_rate': [0.05, 0.5, 0.3]}
  
  cv1 = RepeatedKFold(n_splits=2, n_repeats = 5, random_state = 15)
  
  clf_auc = GridSearchCV(pipeline, cv = cv1, param_grid = parameters, scoring = 'roc_auc', n_jobs=-1, return_train_score=False)
  
  cv1 = RepeatedKFold(n_splits=2, n_repeats = 5,  random_state = 15)                       
  outer_clf_auc = cross_val_score(clf_auc, X_train, y_train, cv = cv1, scoring = 'roc_auc')
  </code></pre>
  
  <p>Question 1.
  How do I fit <code>cross_val_score</code> to the training data?</p>
  
  <p>Question2.
  Since I included the <code>StandardScaler()</code> in the pipeline does it make sense to include the <code>X_train</code> in the <code>cross_val_score</code> or should I use a standardized form of the <code>X_train</code> (i.e. <code>std_X_train</code>)?</p>
  
  <pre><code>std_scaler = StandardScaler().fit(X_train)
  std_X_train = std_scaler.transform(X_train)
  std_X_test = std_scaler.transform(X_test)
  </code></pre>