From bcf1893f0a4b2b40e0e213121631ceb017e70603 Mon Sep 17 00:00:00 2001 From: Juan Martin Loyola Date: Wed, 8 Sep 2021 16:37:44 -0300 Subject: [PATCH 1/2] Remove SelectFdr from DOCSTRING_IGNORE_LIST --- maint_tools/test_docstrings.py | 1 - 1 file changed, 1 deletion(-) diff --git a/maint_tools/test_docstrings.py b/maint_tools/test_docstrings.py index 612817e23f6b9..45b9efcabc208 100644 --- a/maint_tools/test_docstrings.py +++ b/maint_tools/test_docstrings.py @@ -62,7 +62,6 @@ "RobustScaler", "SGDOneClassSVM", "SGDRegressor", - "SelectFdr", "SelectFpr", "SelectFromModel", "SelectFwe", From 98db883d7414fc50378b14d2532833b191ef2526 Mon Sep 17 00:00:00 2001 From: Juan Martin Loyola Date: Wed, 8 Sep 2021 16:38:00 -0300 Subject: [PATCH 2/2] Fix numpydocs from SelectFdr --- .../_univariate_selection.py | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/sklearn/feature_selection/_univariate_selection.py b/sklearn/feature_selection/_univariate_selection.py index 95b244bd2cca6..08e2bcd7aa58d 100644 --- a/sklearn/feature_selection/_univariate_selection.py +++ b/sklearn/feature_selection/_univariate_selection.py @@ -699,7 +699,7 @@ def _get_support_mask(self): class SelectFdr(_BaseFilter): - """Filter: Select the p-values for an estimated false discovery rate + """Filter: Select the p-values for an estimated false discovery rate. This uses the Benjamini-Hochberg procedure. ``alpha`` is an upper bound on the expected false discovery rate. @@ -717,17 +717,6 @@ class SelectFdr(_BaseFilter): alpha : float, default=5e-2 The highest uncorrected p-value for features to keep. - Examples - -------- - >>> from sklearn.datasets import load_breast_cancer - >>> from sklearn.feature_selection import SelectFdr, chi2 - >>> X, y = load_breast_cancer(return_X_y=True) - >>> X.shape - (569, 30) - >>> X_new = SelectFdr(chi2, alpha=0.01).fit_transform(X, y) - >>> X_new.shape - (569, 16) - Attributes ---------- scores_ : array-like of shape (n_features,) @@ -747,10 +736,6 @@ class SelectFdr(_BaseFilter): .. versionadded:: 1.0 - References - ---------- - https://en.wikipedia.org/wiki/False_discovery_rate - See Also -------- f_classif : ANOVA F-value between label/feature for classification tasks. @@ -765,6 +750,21 @@ class SelectFdr(_BaseFilter): SelectFwe : Select features based on family-wise error rate. GenericUnivariateSelect : Univariate feature selector with configurable mode. + + References + ---------- + https://en.wikipedia.org/wiki/False_discovery_rate + + Examples + -------- + >>> from sklearn.datasets import load_breast_cancer + >>> from sklearn.feature_selection import SelectFdr, chi2 + >>> X, y = load_breast_cancer(return_X_y=True) + >>> X.shape + (569, 30) + >>> X_new = SelectFdr(chi2, alpha=0.01).fit_transform(X, y) + >>> X_new.shape + (569, 16) """ def __init__(self, score_func=f_classif, *, alpha=5e-2):