'Fit the model from data in X.
Parameters
X : array-like, shape (n_samples, n_features)
Training vector, where n_samples in the number of samples
and n_features is the number of features.
Returns
self : object
Returns the instance itself.'

def fit(self, X, y=None):

    random_state = check_random_state(self.random_state)
    X = check_array(X)
    (U, (A, B), self.n_iter_) = dict_learning_online(X, self.n_components, self.alpha, n_iter=self.n_iter, return_code=False, method=self.fit_algorithm, n_jobs=self.n_jobs, dict_init=self.dict_init, batch_size=self.batch_size, shuffle=self.shuffle, verbose=self.verbose, random_state=random_state, return_inner_stats=True, return_n_iter=True)
    self.components_ = U
    self.inner_stats_ = (A, B)
    self.iter_offset_ = self.n_iter
    return self
