'Return class labels or probabilities for X for each estimator.
Parameters
X : {array-like, sparse matrix}, shape = [n_samples, n_features]
Training vectors, where n_samples is the number of samples and
n_features is the number of features.
Returns
If `voting=\'soft\'` and `flatten_transform=True`:
array-like = (n_classifiers, n_samples * n_classes)
otherwise array-like = (n_classifiers, n_samples, n_classes)
Class probabilities calculated by each classifier.
If `voting=\'hard\'`:
array-like = [n_samples, n_classifiers]
Class labels predicted by each classifier.'

def transform(self, X):

    check_is_fitted(self, 'estimators_')
    if (self.voting == 'soft'):
        probas = self._collect_probas(X)
        if (self.flatten_transform is None):
            warnings.warn("'flatten_transform'    default    value    will    be    changed    to    True    in    0.21.To    silence    this    warning    you    may    explicitly    set    flatten_transform=False.", DeprecationWarning)
            return probas
        elif (not self.flatten_transform):
            return probas
        else:
            return np.hstack(probas)
    else:
        return self._predict(X)
