title: how can i use cross validation in ensembling models (like voting)?
body: <p>I am trying to use voting model in the ensembling methods, how can i add a cross validation to it?</p>
  <p>Thanks</p>
  <pre><code>
  model_1 = SGD_cls=SGDClassifier(random_state=0)
  model_2 = DecisionTreeClassifier(criterion='entropy', max_depth=12,max_leaf_nodes=35,splitter='best')
  model_3 =  GradientBoostingClassifier(n_estimators=100, random_state=42)
  model_4 =  MLPClassifier(random_state=42)
  # model_3 = KNeighborsClassifier(n_neighbors=2)
  X = df1.drop('product', axis = 1)
  y = df1['product']
  
  X_new = res_fit.transform(X)
  #X_new =pd.DataFrame(X_new,columns = X.iloc[:,res_fit.support_].columns)
  y_pred=cross_val_predict(model,X_new,y,cv=10)
  X_train, X_test, y_train, y_test = train_test_split(X_new, y, test_size=0.25, random_state=42)
  model_5 = VotingClassifier([('ADA', model_1),
                              ('Tree', model_2),
                              ('GradBoost',model_3),
                               ('MLP',model_4)],
                            voting='hard')
  
  for model in (model_1, model_2, model_3,model_4,model_5):
      model.fit(X_train, y_train)
      print(model.__class__.__name__, model.score(X_test, y_test))
  
  </code></pre>