'Fit the model and transform with the final estimator
Fits all the transforms one after the other and transforms the
data, then uses fit_transform on transformed data with 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
Xt : array-like, shape = [n_samples, n_transformed_features]
Transformed samples'

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

    last_step = self._final_estimator
    (Xt, fit_params) = self._fit(X, y, **fit_params)
    if hasattr(last_step, 'fit_transform'):
        return last_step.fit_transform(Xt, y, **fit_params)
    elif (last_step is None):
        return Xt
    else:
        return last_step.fit(Xt, y, **fit_params).transform(Xt)
