'Fit underlying estimators.
Parameters
X : (sparse) array-like, shape = [n_samples, n_features]
Data.
y : numpy array of shape [n_samples]
Multi-class targets.
Returns
self'

def fit(self, X, y):

    (X, y) = check_X_y(X, y)
    if (self.code_size <= 0):
        raise ValueError('code_size    should    be    greater    than    0,    got    {0}'.format(self.code_size))
    _check_estimator(self.estimator)
    random_state = check_random_state(self.random_state)
    check_classification_targets(y)
    self.classes_ = np.unique(y)
    n_classes = self.classes_.shape[0]
    code_size_ = int((n_classes * self.code_size))
    self.code_book_ = random_state.random_sample((n_classes, code_size_))
    self.code_book_[(self.code_book_ > 0.5)] = 1
    if hasattr(self.estimator, 'decision_function'):
        self.code_book_[(self.code_book_ != 1)] = (-1)
    else:
        self.code_book_[(self.code_book_ != 1)] = 0
    classes_index = dict(((c, i) for (i, c) in enumerate(self.classes_)))
    Y = np.array([self.code_book_[classes_index[y[i]]] for i in range(X.shape[0])], dtype=np.int)
    self.estimators_ = Parallel(n_jobs=self.n_jobs)((delayed(_fit_binary)(self.estimator, X, Y[:, i]) for i in range(Y.shape[1])))
    return self
