code: def fit(self, X, y=None, **fit_params):
          
          Xt, yt, fit_params = self._fit(X, y, **fit_params)
  
          self.N_train = len(yt)
  
          if self._final_estimator is not None:
              fitres = self._final_estimator.fit(Xt, yt, **fit_params)
              if hasattr(fitres, 'history'):
                  self.history = fitres
  
          return self
docs: Fit the model
  
          Fit all the transforms one after the other and transform the
          data, then fit the transformed data using the final estimator.
  
          Parameters
          ----------
          X : iterable
              Training data. Must fulfill input requirements of first step of the
              pipeline.
          y : iterable, default=None
              Training targets. Must fulfill label requirements for all steps of
              the pipeline.
          **fit_params : dict of string -> object
              Parameters passed to the ``fit`` method of each step, where
              each parameter name is prefixed such that parameter ``p`` for step
              ``s`` has key ``s__p``.
  
          Returns
          -------
          self : Pipeline
              This estimator