Skip to content

univariate_selection -> feature_selection -> selectFDR is wrong ? #7474

Closed

Description

@mpjlu

Description

scikit-learn/sklearn/feature_selection/univariate_selection.py line 577:

def _get_support_mask(self):
    check_is_fitted(self, 'scores_')

    n_features = len(self.pvalues_)
    sv = np.sort(self.pvalues_)

    # here
    selected = sv[sv <= float(self.alpha) / n_features
                  * np.arange(n_features)]

    if selected.size == 0:
        return np.zeros_like(self.pvalues_, dtype=bool)
    return self.pvalues_ <= selected.max()

Should Be:

    selected = sv[sv <= float(self.alpha) / n_features
                  * (np.arange(n_features) + 1)]

Because np.arange is start from 0, here it should be start from 1

Activity

  1. agramfort commented on Sep 24, 2016

    @agramfort
    Member

    @bthirion any comment?

  2. jnothman commented on Sep 25, 2016

    @jnothman
    Member

    It does seem a bit of a harsh criterion!

  3. mpjlu commented on Sep 25, 2016

    @mpjlu
    Author

    consider the first element

  4. mpjlu commented on Sep 25, 2016

    @mpjlu
    Author

    hi @jnothman any more comments

  5. bthirion commented on Sep 25, 2016

    @bthirion
    Member

    I agree with the comment.

  6. jnothman commented on Sep 26, 2016

    @jnothman
    Member

    So I suppose we mark this as a (long-standing) bug and fix it without notice?

  7. added
    Easy
    on Sep 26, 2016
  8. modified the milestone: 0.19 on Sep 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugEasy

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions