From 9ce43dd2a802a55a6091a21220aed2c7b9493f63 Mon Sep 17 00:00:00 2001 From: Juan Martin Loyola Date: Wed, 8 Sep 2021 16:47:39 -0300 Subject: [PATCH 1/2] Remove SelectFwe 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..2d18b8d7fa6ea 100644 --- a/maint_tools/test_docstrings.py +++ b/maint_tools/test_docstrings.py @@ -65,7 +65,6 @@ "SelectFdr", "SelectFpr", "SelectFromModel", - "SelectFwe", "SelectKBest", "SelfTrainingClassifier", "SequentialFeatureSelector", From ce04847a6f08d8e880dc2f231cb0d1dfb4f3893f Mon Sep 17 00:00:00 2001 From: Juan Martin Loyola Date: Wed, 8 Sep 2021 16:48:05 -0300 Subject: [PATCH 2/2] Fix numpydocs from SelectFwe --- .../_univariate_selection.py | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sklearn/feature_selection/_univariate_selection.py b/sklearn/feature_selection/_univariate_selection.py index 95b244bd2cca6..159e25542ef37 100644 --- a/sklearn/feature_selection/_univariate_selection.py +++ b/sklearn/feature_selection/_univariate_selection.py @@ -785,7 +785,7 @@ def _get_support_mask(self): class SelectFwe(_BaseFilter): - """Filter: Select the p-values corresponding to Family-wise error rate + """Filter: Select the p-values corresponding to Family-wise error rate. Read more in the :ref:`User Guide `. @@ -800,17 +800,6 @@ class SelectFwe(_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 SelectFwe, chi2 - >>> X, y = load_breast_cancer(return_X_y=True) - >>> X.shape - (569, 30) - >>> X_new = SelectFwe(chi2, alpha=0.01).fit_transform(X, y) - >>> X_new.shape - (569, 15) - Attributes ---------- scores_ : array-like of shape (n_features,) @@ -842,6 +831,17 @@ class SelectFwe(_BaseFilter): SelectFdr : Select features based on an estimated false discovery rate. GenericUnivariateSelect : Univariate feature selector with configurable mode. + + Examples + -------- + >>> from sklearn.datasets import load_breast_cancer + >>> from sklearn.feature_selection import SelectFwe, chi2 + >>> X, y = load_breast_cancer(return_X_y=True) + >>> X.shape + (569, 30) + >>> X_new = SelectFwe(chi2, alpha=0.01).fit_transform(X, y) + >>> X_new.shape + (569, 15) """ def __init__(self, score_func=f_classif, *, alpha=5e-2):