# Buggy code
def fit(self, X, y):
    """Fit the RFE model and then the underlying estimator on the selected
       features.

    Parameters
    ----------
    X : {array-like, sparse matrix}, shape = [n_samples, n_features]
        The training input samples.

    y : array-like, shape = [n_samples]
        The target values.
    """
    X, y = check_X_y(X, y, "csc")
    # Initialization
    n_features = X.shape[1]
    if self.n_features_to_select is None:
        n_features_to_select = n_features / 2
    else:
        n_features_to_select = self.n_features_to_select

    if 0.0 < self.step < 1.0:
        step = int(max(1, self.step * n_features))
    else:
        step = int(self.step)
    if step <= 0:
        raise ValueError("Step must be >0")

    support_ = np.ones(n_features, dtype=np.bool)
    ranking_ = np.ones(n_features, dtype=np.int)
    # Elimination
    while np.sum(support_) > n_features_to_select:
        # Remaining features
        features = np.arange(n_features)[support_]

        # Rank the remaining features
        estimator = clone(self.estimator)
        estimator.set_params(**self.estimator_params)
        if self.verbose > 0:
            print("Fitting estimator with %d features." % np.sum(support_))

        estimator.fit(X[:, features], y)

        if estimator.coef_.ndim > 1:
            ranks = np.argsort(safe_sqr(estimator.coef_).sum(axis=0))
        else:
            ranks = np.argsort(safe_sqr(estimator.coef_))

        # for sparse case ranks is matrix
        ranks = np.ravel(ranks)

        # Eliminate the worse features
        threshold = min(step, np.sum(support_) - n_features_to_select)
        support_[features[ranks][:threshold]] = False
        ranking_[np.logical_not(support_)] += 1

    # Set final attributes
    self.estimator_ = clone(self.estimator)
    self.estimator_.set_params(**self.estimator_params)
    self.estimator_.fit(X[:, support_], y)
    self.n_features_ = support_.sum()
    self.support_ = support_
    self.ranking_ = ranking_

    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 RFE model and then the underlying estimator on the selected
       features.

    Parameters
    ----------
    X : {array-like, sparse matrix}, shape = [n_samples, n_features]
        The training input samples.

    y : array-like, shape = [n_samples]
        The target values.
    """
    X, y = check_X_y(X, y, "csc")
    # Initialization
    n_features = X.shape[1]
    if self.n_features_to_select is None:
        n_features_to_select = n_features / 2
    else:
        n_features_to_select = self.n_features_to_select

    if 0.0 < self.step < 1.0:
        step = int(max(1, self.step * n_features))
    else:
        step = int(self.step)
    if step <= 0:
        raise ValueError("Step must be >0")

    if self.estimator_params is not None:
        warnings.warn(
            "The parameter 'estimator_params' is deprecated as of version 0.16 "
            "and will be removed in 0.18. The parameter is no longer "
            "necessary because the value is set via the estimator initialisation "
            "or set_params function.",
            DeprecationWarning,
        )

    support_ = np.ones(n_features, dtype=np.bool)
    ranking_ = np.ones(n_features, dtype=np.int)
    # Elimination
    while np.sum(support_) > n_features_to_select:
        # Remaining features
        features = np.arange(n_features)[support_]

        # Rank the remaining features
        estimator = clone(self.estimator)
        if self.estimator_params:
            estimator.set_params(**self.estimator_params)
        if self.verbose > 0:
            print("Fitting estimator with %d features." % np.sum(support_))

        estimator.fit(X[:, features], y)

        if estimator.coef_.ndim > 1:
            ranks = np.argsort(safe_sqr(estimator.coef_).sum(axis=0))
        else:
            ranks = np.argsort(safe_sqr(estimator.coef_))

        # for sparse case ranks is matrix
        ranks = np.ravel(ranks)

        # Eliminate the worse features
        threshold = min(step, np.sum(support_) - n_features_to_select)
        support_[features[ranks][:threshold]] = False
        ranking_[np.logical_not(support_)] += 1

    # Set final attributes
    self.estimator_ = clone(self.estimator)
    if self.estimator_params:
        self.estimator_.set_params(**self.estimator_params)
    self.estimator_.fit(X[:, support_], y)
    self.n_features_ = support_.sum()
    self.support_ = support_
    self.ranking_ = ranking_

    return self