'Fit the label sets binarizer and transform the given label sets
Parameters
y : iterable of iterables
A set of labels (any orderable and hashable object) for each
sample. If the `classes` parameter is set, `y` will not be
iterated.
Returns
y_indicator : array or CSR matrix, shape (n_samples, n_classes)
A matrix such that `y_indicator[i, j] = 1` iff `classes_[j]` is in
`y[i]`, and 0 otherwise.'

def fit_transform(self, y):

    if (self.classes is not None):
        return self.fit(y).transform(y)
    class_mapping = defaultdict(int)
    class_mapping.default_factory = class_mapping.__len__
    yt = self._transform(y, class_mapping)
    tmp = sorted(class_mapping, key=class_mapping.get)
    dtype = (np.int if all((isinstance(c, int) for c in tmp)) else object)
    class_mapping = np.empty(len(tmp), dtype=dtype)
    class_mapping[:] = tmp
    (self.classes_, inverse) = np.unique(class_mapping, return_inverse=True)
    yt.indices = np.array(inverse[yt.indices], dtype=yt.indices.dtype, copy=False)
    if (not self.sparse_output):
        yt = yt.toarray()
    return yt
