# Buggy code
def fit(self, X, y):
    """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,)
        Target values.

    Returns
    -------
    self : object
        returns an instance of self.
    """
    self.fit_path = True
    X, y = check_X_y(X, y)

    # init cross-validation generator
    cv = check_cv(self.cv, X, y, classifier=False)

    Gram = "auto" if self.precompute else None

    cv_paths = Parallel(n_jobs=self.n_jobs, verbose=self.verbose)(
        delayed(_lars_path_residues)(
            X[train],
            y[train],
            X[test],
            y[test],
            Gram=Gram,
            copy=False,
            method=self.method,
            verbose=max(0, self.verbose - 1),
            normalize=self.normalize,
            fit_intercept=self.fit_intercept,
            max_iter=self.max_iter,
            eps=self.eps,
        )
        for train, test in cv
    )
    all_alphas = np.concatenate(list(zip(*cv_paths))[0])
    # Unique also sorts
    all_alphas = np.unique(all_alphas)
    # Take at most max_n_alphas values
    stride = int(max(1, int(len(all_alphas) / float(self.max_n_alphas))))
    all_alphas = all_alphas[::stride]

    mse_path = np.empty((len(all_alphas), len(cv_paths)))
    for index, (alphas, active, coefs, residues) in enumerate(cv_paths):
        alphas = alphas[::-1]
        residues = residues[::-1]
        if alphas[0] != 0:
            alphas = np.r_[0, alphas]
            residues = np.r_[residues[0, np.newaxis], residues]
        if alphas[-1] != all_alphas[-1]:
            alphas = np.r_[alphas, all_alphas[-1]]
            residues = np.r_[residues, residues[-1, np.newaxis]]
        this_residues = interpolate.interp1d(alphas, residues, axis=0)(all_alphas)
        this_residues **= 2
        mse_path[:, index] = np.mean(this_residues, axis=-1)

    mask = np.all(np.isfinite(mse_path), axis=-1)
    all_alphas = all_alphas[mask]
    mse_path = mse_path[mask]
    # Select the alpha that minimizes left-out error
    i_best_alpha = np.argmin(mse_path.mean(axis=-1))
    best_alpha = all_alphas[i_best_alpha]

    # Store our parameters
    self.alpha_ = best_alpha
    self.cv_alphas_ = all_alphas
    self.cv_mse_path_ = mse_path

    # Now compute the full model
    # it will call a lasso internally when self if LassoLarsCV
    # as self.method == 'lasso'
    Lars.fit(self, X, y)
    return self


# Traceback (AssertionError)
======================================================================
FAIL: Tests that class_weight and sample_weight are multiplicative
----------------------------------------------------------------------
Traceback (most recent call last):
File "/tmp/buildd/scikit-learn-0.16.0~b1+git1-gab4d07d/debian/python-sklearn/usr/lib/python2.7/dist-packages/sklearn/linear_model/tests/test_sgd.py", line 633, in test_weights_multiplied
assert_array_equal(clf1.coef_, clf2.coef_)
File "/usr/lib/python2.7/dist-packages/numpy/testing/utils.py", line 718, in assert_array_equal
verbose=verbose, header='Arrays are not equal')
File "/usr/lib/python2.7/dist-packages/numpy/testing/utils.py", line 644, in assert_array_compare
raise AssertionError(msg)
AssertionError:
Arrays are not equal

(mismatch 16.6666666667%)
x: array([[-0.34681637, -0.32240913, -0.31335029,  0.34920789,  0.3658206 ,
0.38752489]])
y: array([[-0.34681637, -0.32240913, -0.31335029,  0.34920789,  0.3658206 ,
0.38752489]])

# Fixed code
def fit(self, X, y):
    """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,)
        Target values.

    Returns
    -------
    self : object
        returns an instance of self.
    """
    self.fit_path = True
    X, y = check_X_y(X, y, y_numeric=True)

    # init cross-validation generator
    cv = check_cv(self.cv, X, y, classifier=False)

    Gram = "auto" if self.precompute else None

    cv_paths = Parallel(n_jobs=self.n_jobs, verbose=self.verbose)(
        delayed(_lars_path_residues)(
            X[train],
            y[train],
            X[test],
            y[test],
            Gram=Gram,
            copy=False,
            method=self.method,
            verbose=max(0, self.verbose - 1),
            normalize=self.normalize,
            fit_intercept=self.fit_intercept,
            max_iter=self.max_iter,
            eps=self.eps,
        )
        for train, test in cv
    )
    all_alphas = np.concatenate(list(zip(*cv_paths))[0])
    # Unique also sorts
    all_alphas = np.unique(all_alphas)
    # Take at most max_n_alphas values
    stride = int(max(1, int(len(all_alphas) / float(self.max_n_alphas))))
    all_alphas = all_alphas[::stride]

    mse_path = np.empty((len(all_alphas), len(cv_paths)))
    for index, (alphas, active, coefs, residues) in enumerate(cv_paths):
        alphas = alphas[::-1]
        residues = residues[::-1]
        if alphas[0] != 0:
            alphas = np.r_[0, alphas]
            residues = np.r_[residues[0, np.newaxis], residues]
        if alphas[-1] != all_alphas[-1]:
            alphas = np.r_[alphas, all_alphas[-1]]
            residues = np.r_[residues, residues[-1, np.newaxis]]
        this_residues = interpolate.interp1d(alphas, residues, axis=0)(all_alphas)
        this_residues **= 2
        mse_path[:, index] = np.mean(this_residues, axis=-1)

    mask = np.all(np.isfinite(mse_path), axis=-1)
    all_alphas = all_alphas[mask]
    mse_path = mse_path[mask]
    # Select the alpha that minimizes left-out error
    i_best_alpha = np.argmin(mse_path.mean(axis=-1))
    best_alpha = all_alphas[i_best_alpha]

    # Store our parameters
    self.alpha_ = best_alpha
    self.cv_alphas_ = all_alphas
    self.cv_mse_path_ = mse_path

    # Now compute the full model
    # it will call a lasso internally when self if LassoLarsCV
    # as self.method == 'lasso'
    Lars.fit(self, X, y)
    return self