'Apply transforms, and score with the final estimator
Parameters
X : iterable
Data to predict on. Must fulfill input requirements of first step
of the pipeline.
y : iterable, default=None
Targets used for scoring. Must fulfill label requirements for all
steps of the pipeline.
sample_weight : array-like, default=None
If not None, this argument is passed as ``sample_weight`` keyword
argument to the ``score`` method of the final estimator.
Returns
score : float'

@if_delegate_has_method(delegate='_final_estimator')
def score(self, X, y=None, sample_weight=None):

    Xt = X
    for (name, transform) in self.steps[:(-1)]:
        if (transform is not None):
            Xt = transform.transform(Xt)
    score_params = {}
    if (sample_weight is not None):
        score_params['sample_weight'] = sample_weight
    return self.steps[(-1)][(-1)].score(Xt, y, **score_params)
