class_docstr: Meta ensembling, also known as stacking. See
  http://blog.kaggle.com/2016/12/27/a-kagglers-guide-to-model-stacking-in-practice/
  for more information
  
  Parameters
  ----------
  base_estimators: list or numpy array (n_estimators,)
      A list of base classifiers.
  
  meta_clf : object, optional (default=LogisticRegression)
      The meta classifier to make the final prediction.
  
  n_folds : int, optional (default=2)
      The number of splits of the training sample.
  
  keep_original : bool, optional (default=False)
      If True, keep the original features for training and predicting.
  
  use_proba : bool, optional (default=False)
      If True, use the probability prediction as the new features.
  
  shuffle_data : bool, optional (default=False)
      If True, shuffle the input data.
  
  random_state : int, RandomState or None, optional (default=None)
      If int, random_state is the seed used by the random
      number generator; If RandomState instance, random_state is the random
      number generator; If None, the random number generator is the
      RandomState instance used by `np.random`.
  
  threshold : float in (0, 1), optional (default=None)
      Cut-off value to convert scores into binary labels.
  
  pre_fitted : bool, optional (default=False)
      Whether the base classifiers are trained. If True, `fit`
      process may be skipped.
class_docstr_tok: ["Meta","ensembling",",","also","known","as","stacking",".","See","http",":","\/\/blog.kaggle.com\/2016\/12\/27\/a-kagglers-guide-to-model-stacking-in-practice\/","for","more","information","Parameters","--","--","--","--","--","base_estimators",":","list","or","numpy","array","(","n_estimators",",",")","A","list","of","base","classifiers",".","meta_clf",":","object",",","optional","(","default=LogisticRegression",")","The","meta","classifier","to","make","the","final","prediction",".","n_folds",":","int",",","optional","(","default=2",")","The","number","of","splits","of","the","training","sample",".","keep_original",":","bool",",","optional","(","default=False",")","If","True",",","keep","the","original","features","for","training","and","predicting",".","use_proba",":","bool",",","optional","(","default=False",")","If","True",",","use","the","probability","prediction","as","the","new","features",".","shuffle_data",":","bool",",","optional","(","default=False",")","If","True",",","shuffle","the","input","data",".","random_state",":","int",",","RandomState","or","None",",","optional","(","default=None",")","If","int",",","random_state","is","the","seed","used","by","the","random","number","generator",";","If","RandomState","instance",",","random_state","is","the","random","number","generator",";","If","None",",","the","random","number","generator","is","the","RandomState","instance","used","by","`","np.random","`",".","threshold",":","float","in","(","0",",","1",")",",","optional","(","default=None",")","Cut-off","value","to","convert","scores","into","binary","labels",".","pre_fitted",":","bool",",","optional","(","default=False",")","Whether","the","base","classifiers","are","trained",".","If","True",",","`","fit","`","process","may","be","skipped","."]
docstr: Fit classifier.
  
  Parameters
  ----------
  X : numpy array of shape (n_samples, n_features)
      The input samples.
  
  y : numpy array of shape (n_samples,), optional (default=None)
      The ground truth of the input samples (labels).
docstr_tok: ["Fit","classifier",".","Parameters","--","--","--","--","--","X",":","numpy","array","of","shape","(","n_samples",",","n_features",")","The","input","samples",".","y",":","numpy","array","of","shape","(","n_samples",",",")",",","optional","(","default=None",")","The","ground","truth","of","the","input","samples","(","labels",")","."]
code: def fit(self, X, y):
      """Fit classifier.
  
      Parameters
      ----------
      X : numpy array of shape (n_samples, n_features)
          The input samples.
  
      y : numpy array of shape (n_samples,), optional (default=None)
          The ground truth of the input samples (labels).
      """
  
      # Validate inputs X and y
      X, y = check_X_y(X, y)
      X = check_array(X)
      self._set_n_classes(y)
  
      n_samples = X.shape[0]
  
      # initialize matrix for storing newly generated features
      new_features = np.zeros([n_samples, self.n_base_estimators_])
  
      # build CV datasets
      X_new, y_new, index_lists = split_datasets(
          X,
          y,
          n_folds=self.n_folds,
          shuffle_data=self.shuffle_data,
          random_state=self.random_state,
      )
  
      # iterate over all base classifiers
      for i, clf in enumerate(self.base_estimators):
          # iterate over all folds
          for j in range(self.n_folds):
              # build train and test index
              full_idx = list(range(n_samples))
              test_idx = index_lists[j]
              train_idx = list_diff(full_idx, test_idx)
              X_train, y_train = X_new[train_idx, :], y_new[train_idx]
              X_test, y_test = X_new[test_idx, :], y_new[test_idx]
  
              # train the classifier
              clf.fit(X_train, y_train)
  
              # generate the new features on the pseudo test set
              if self.use_proba:
                  new_features[test_idx, i] = clf.predict_proba(X_test)[
                      :, 1
                  ]
              else:
                  new_features[test_idx, i] = clf.predict(X_test)
  
      # build the new dataset for training
      if self.keep_original:
          X_new_comb = np.concatenate([X_new, new_features], axis=1)
      else:
          X_new_comb = new_features
      y_new_comb = y_new
  
      # train the meta classifier
      self.meta_clf.fit(X_new_comb, y_new_comb)
      self.fitted_ = True
  
      # train all base classifiers on the full train dataset
      # iterate over all base classifiers
      for i, clf in enumerate(self.base_estimators):
          clf.fit(X_new, y_new)
  
      return
  
file_path: combo/combo/models/classifier_stacking.py
imports: import warnings
  import numpy
  from sklearn.linear_model import LogisticRegression
  from sklearn.utils import shuffle
  from sklearn.utils import check_random_state
  from sklearn.utils import check_array
  from sklearn.utils import check_X_y
  from sklearn.utils.validation import check_is_fitted
  from pyod.utils.utility import check_parameter
  from ..utils.utility import list_diff
  from .base import BaseAggregator
label_desc: Use image node_id 2 for calling the Stacking obj's underlying member method code with example usage: obj.fit(X, y) without return types