original_docstring:  Trains the SST model for the given input and output examples.
  
              Parameters
              ----------
                  X: pandas.DataFrame or numpy.ndarray
                      The input values.
                  Y: pandas.DataFrame or numpy.ndarray
                      The targets values.
          
docstring: Trains the SST model for the given input and output examples.
  Parameters
  
  
docstring_tokens: Trains the SST model for the given input and output examples . Parameters
code: def fit(self, X, Y):
          """ Trains the SST model for the given input and output examples.
  
              Parameters
              ----------
                  X: pandas.DataFrame or numpy.ndarray
                      The input values.
                  Y: pandas.DataFrame or numpy.ndarray
                      The targets values.
          """
          if isinstance(X, pd.core.frame.DataFrame):
              X = X.values
          elif not isinstance(X, np.ndarray):
              raise ValueError('"X" must be a numpy matrix or pandas \
                               DataFrame')
          if isinstance(Y, pd.core.frame.DataFrame):
              Y = Y.values
          elif not isinstance(Y, np.ndarray):
              raise ValueError('"Y" must be a numpy matrix or pandas \
                               DataFrame')
  
          self._base_models = {}
          self._meta_models = {}
  
          # Training the base models
          for t in range(self.n_targets):
              self._base_models[t] = self._regressors[(t, 0)]['model'](
                  **self._regressors[(t, 0)]['params']
              )
              self._base_models[t].fit(X, Y[:, t])
  
          base_predictions = np.zeros_like(Y)
  
          # Getting the base predictions
          if self.method == self.INTERNAL_CV:
              for t in range(self.n_targets):
                  base_predictions[:, t] = cross_val_predict(
                      self._regressors[(t, 0)]['model'](
                          **self._regressors[(t, 0)]['params']
                      ),
                      X,
                      Y[:, t],
                      cv=self._cv
                  )
          elif self.method == self.PREDICTIONS:
              for t in range(self.n_targets):
                  base_predictions[:, t] = self._base_models[t].predict(X)
          elif self.method == self.TARGETS_VALUES:
              base_predictions = Y.copy()
  
          # Augmented training set
          X_aug = np.column_stack((X, base_predictions))
  
          # Training the meta_models
          for t in range(self.n_targets):
              self._meta_models[t] = self._regressors[(t, 1)]['model'](
                  **self._regressors[(t, 1)]['params']
              )
              self._meta_models[t].fit(X_aug, Y[:, t])
code_tokens: def fit ( self , X , Y ) : if isinstance ( X , pd . core . frame . DataFrame ) : X = X . values elif not isinstance ( X , np . ndarray ) : raise ValueError ( '"X" must be a numpy matrix or pandas \
                               DataFrame' ) if isinstance ( Y , pd . core . frame . DataFrame ) : Y = Y . values elif not isinstance ( Y , np . ndarray ) : raise ValueError ( '"Y" must be a numpy matrix or pandas \
                               DataFrame' ) self . _base_models = { } self . _meta_models = { } for t in range ( self . n_targets ) : self . _base_models [ t ] = self . _regressors [ ( t , 0 ) ] [ 'model' ] ( ** self . _regressors [ ( t , 0 ) ] [ 'params' ] ) self . _base_models [ t ] . fit ( X , Y [ : , t ] ) base_predictions = np . zeros_like ( Y ) if self . method == self . INTERNAL_CV : for t in range ( self . n_targets ) : base_predictions [ : , t ] = cross_val_predict ( self . _regressors [ ( t , 0 ) ] [ 'model' ] ( ** self . _regressors [ ( t , 0 ) ] [ 'params' ] ) , X , Y [ : , t ] , cv = self . _cv ) elif self . method == self . PREDICTIONS : for t in range ( self . n_targets ) : base_predictions [ : , t ] = self . _base_models [ t ] . predict ( X ) elif self . method == self . TARGETS_VALUES : base_predictions = Y . copy ( ) X_aug = np . column_stack ( ( X , base_predictions ) ) for t in range ( self . n_targets ) : self . _meta_models [ t ] = self . _regressors [ ( t , 1 ) ] [ 'model' ] ( ** self . _regressors [ ( t , 1 ) ] [ 'params' ] ) self . _meta_models [ t ] . fit ( X_aug , Y [ : , t ] )
short_docstring: Trains the SST model for the given input and output examples.
short_docstring_tokens: Trains the SST model for the given input and output examples .
comment: """ Trains the SST model for the given input and output examples.
  
              Parameters
              ----------
                  X: pandas.DataFrame or numpy.ndarray
                      The input values.
                  Y: pandas.DataFrame or numpy.ndarray
                      The targets values.
          """$SEP$# Training the base models$SEP$# Getting the base predictions$SEP$# Augmented training set$SEP$# Training the meta_models