class_docstr: A Stacking regressor.
  
   A stacking regressor is a regressor that uses the predictions of
  several first layer estimators (generated with a cross validation method)
  for a second layer estimator.
  
  
  Parameters
  ----------
  base_estimators : list, default = [Regressor(strategy="LightGBM"),
                                     Regressor(strategy="RandomForest"),
                                     Regressor(strategy="ExtraTrees")]
      List of estimators to fit in the first level using a cross validation.
  
  level_estimator : object, default = LinearRegression()
      The estimator used in second and last level
  
  n_folds : int, default = 5
      Number of folds used to generate the meta features for the training set
  
  copy : bool, default = False
      If true, meta features are added to the original dataset
  
  random_state : None, int or RandomState. default = 1
      Pseudo-random number generator state used for shuffling.
      If None, use default numpy RNG for shuffling.
  
  verbose : bool, default = True
      Verbose mode.
class_docstr_tok: ["A","Stacking","regressor",".","A","stacking","regressor","is","a","regressor","that","uses","the","predictions","of","several","first","layer","estimators","(","generated","with","a","cross","validation","method",")","for","a","second","layer","estimator",".","Parameters","--","--","--","--","--","base_estimators",":","list",",","default","=","[","Regressor","(","strategy=","''","LightGBM","''",")",",","Regressor","(","strategy=","''","RandomForest","''",")",",","Regressor","(","strategy=","''","ExtraTrees","''",")","]","List","of","estimators","to","fit","in","the","first","level","using","a","cross","validation",".","level_estimator",":","object",",","default","=","LinearRegression","(",")","The","estimator","used","in","second","and","last","level","n_folds",":","int",",","default","=","5","Number","of","folds","used","to","generate","the","meta","features","for","the","training","set","copy",":","bool",",","default","=","False","If","true",",","meta","features","are","added","to","the","original","dataset","random_state",":","None",",","int","or","RandomState",".","default","=","1","Pseudo-random","number","generator","state","used","for","shuffling",".","If","None",",","use","default","numpy","RNG","for","shuffling",".","verbose",":","bool",",","default","=","True","Verbose","mode","."]
docstr: Fit the first level estimators and the second level estimator on X.
  
  Parameters
  ----------
  df_train : pandas DataFrame of shape (n_samples, n_features)
      Input data
  
  y_train : pandas series of shape = (n_samples, )
      The target
  
  Returns
  -------
  object
      self
docstr_tok: ["Fit","the","first","level","estimators","and","the","second","level","estimator","on","X.","Parameters","--","--","--","--","--","df_train",":","pandas","DataFrame","of","shape","(","n_samples",",","n_features",")","Input","data","y_train",":","pandas","series","of","shape","=","(","n_samples",",",")","The","target","Returns","--","--","--","-","object","self"]
code: def fit(self, df_train, y_train):
      """Fit the first level estimators and the second level estimator on X.
  
      Parameters
      ----------
      df_train : pandas DataFrame of shape (n_samples, n_features)
          Input data
  
      y_train : pandas series of shape = (n_samples, )
          The target
  
      Returns
      -------
      object
          self
  
      """
      # Fit the base estimators
      df_train = self.fit_transform(df_train, y_train)
  
      if self.verbose:
          print("")
          print(
              "[=========================================================="
              "===============] PREDICTION LAYER [========================"
              "====================================================]"
          )
          print("")
          print(
              "> fitting estimator : "
              + str(self.level_estimator.get_params())
              + " ..."
          )
          print("")
  
      # we fit the second level estimator
      self.level_estimator.fit(df_train.values, y_train.values)
  
      self.__fitOK = True
  
      return self
  
file_path: MLBox/mlbox/model/regression/stacking_regressor.py
imports: import numpy
  import pandas
  from sklearn.linear_model import LinearRegression
  from sklearn.model_selection import KFold, cross_val_predict
  from copy import copy
  from .regressor import Regressor
  import warnings
label_desc: Use image node_id 6 for calling the StackingRegressor obj's underlying member method code with example usage: obj.fit(df_train, y_train) and returns: self