'Fit model with coordinate descent.
Parameters
X : ndarray or scipy.sparse matrix, (n_samples, n_features)
Data
y : ndarray, shape (n_samples,) or (n_samples, n_targets)
Target. Will be cast to X\'s dtype if necessary
check_input : boolean, (default=True)
Allow to bypass several input checking.
Don\'t use this parameter unless you know what you do.
Notes
Coordinate descent is an algorithm that considers each column of
data at a time hence it will automatically convert the X input
as a Fortran-contiguous numpy array if necessary.
To avoid memory re-allocation it is advised to allocate the
initial data in memory directly using that format.'

def fit(self, X, y, check_input=True):

    if (self.alpha == 0):
        warnings.warn('With    alpha=0,    this    algorithm    does    not    converge    well.    You    are    advised    to    use    the    LinearRegression    estimator', stacklevel=2)
    if isinstance(self.precompute, six.string_types):
        raise ValueError(('precompute    should    be    one    of    True,    False    or    array-like.    Got    %r' % self.precompute))
    if check_input:
        (X, y) = check_X_y(X, y, accept_sparse='csc', order='F', dtype=[np.float64, np.float32], copy=(self.copy_X and self.fit_intercept), multi_output=True, y_numeric=True)
        y = check_array(y, order='F', copy=False, dtype=X.dtype.type, ensure_2d=False)
    (X, y, X_offset, y_offset, X_scale, precompute, Xy) = _pre_fit(X, y, None, self.precompute, self.normalize, self.fit_intercept, copy=False)
    if (y.ndim == 1):
        y = y[:, np.newaxis]
    if ((Xy is not None) and (Xy.ndim == 1)):
        Xy = Xy[:, np.newaxis]
    (n_samples, n_features) = X.shape
    n_targets = y.shape[1]
    if (self.selection not in ['cyclic', 'random']):
        raise ValueError('selection    should    be    either    random    or    cyclic.')
    if ((not self.warm_start) or (not hasattr(self, 'coef_'))):
        coef_ = np.zeros((n_targets, n_features), dtype=X.dtype, order='F')
    else:
        coef_ = self.coef_
        if (coef_.ndim == 1):
            coef_ = coef_[np.newaxis, :]
    dual_gaps_ = np.zeros(n_targets, dtype=X.dtype)
    self.n_iter_ = []
    for k in xrange(n_targets):
        if (Xy is not None):
            this_Xy = Xy[:, k]
        else:
            this_Xy = None
        (_, this_coef, this_dual_gap, this_iter) = self.path(X, y[:, k], l1_ratio=self.l1_ratio, eps=None, n_alphas=None, alphas=[self.alpha], precompute=precompute, Xy=this_Xy, fit_intercept=False, normalize=False, copy_X=True, verbose=False, tol=self.tol, positive=self.positive, X_offset=X_offset, X_scale=X_scale, return_n_iter=True, coef_init=coef_[k], max_iter=self.max_iter, random_state=self.random_state, selection=self.selection, check_input=False)
        coef_[k] = this_coef[:, 0]
        dual_gaps_[k] = this_dual_gap[0]
        self.n_iter_.append(this_iter[0])
    if (n_targets == 1):
        self.n_iter_ = self.n_iter_[0]
    (self.coef_, self.dual_gap_) = map(np.squeeze, [coef_, dual_gaps_])
    self._set_intercept(X_offset, y_offset, X_scale)
    self.coef_ = np.asarray(self.coef_, dtype=X.dtype)
    return self
