'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)
    if (self.n_components is None):
        n_components = X.shape[1]
    else:
        n_components = self.n_components
    (Vt, _, self.n_iter_) = dict_learning_online(X.T, n_components, alpha=self.alpha, n_iter=self.n_iter, return_code=True, dict_init=None, verbose=self.verbose, callback=self.callback, batch_size=self.batch_size, shuffle=self.shuffle, n_jobs=self.n_jobs, method=self.method, random_state=random_state, return_n_iter=True)
    self.components_ = Vt.T
    return self
