'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'

def fit(self, X, y=None, **fit_params):

    (Xt, fit_params) = self._fit(X, y, **fit_params)
    if (self._final_estimator is not None):
        self._final_estimator.fit(Xt, y, **fit_params)
    return self
