8000 univariate_selection -> feature_selection -> selectFDR is wrong ? · Issue #7474 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

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

@mpjlu

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugEasyWell-defined and straightforward way to resolve

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0