'Fit the model using X, y as training data.
Parameters
X : array-like, shape (n_samples, n_features)
Training data.
y : array-like, shape (n_samples,) or (n_samples, n_targets)
Target values.
Xy : array-like, shape (n_samples,) or (n_samples, n_targets),                 optional
Xy = np.dot(X.T, y) that can be precomputed. It is useful
only when the Gram matrix is precomputed.
Returns
self : object
returns an instance of self.'

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

    (X, y) = check_X_y(X, y, y_numeric=True, multi_output=True)
    alpha = getattr(self, 'alpha', 0.0)
    if hasattr(self, 'n_nonzero_coefs'):
        alpha = 0.0
        max_iter = self.n_nonzero_coefs
    else:
        max_iter = self.max_iter
    self._fit(X, y, max_iter=max_iter, alpha=alpha, fit_path=self.fit_path, Xy=Xy)
    return self
