diff --git a/maint_tools/test_docstrings.py b/maint_tools/test_docstrings.py index 9829abbb9a0e3..2c26869a65c1a 100644 --- a/maint_tools/test_docstrings.py +++ b/maint_tools/test_docstrings.py @@ -61,7 +61,6 @@ "SGDOneClassSVM", "SGDRegressor", "SelectFromModel", - "SelectFwe", "SelfTrainingClassifier", "SequentialFeatureSelector", "SimpleImputer", diff --git a/sklearn/feature_selection/_univariate_selection.py b/sklearn/feature_selection/_univariate_selection.py index c79b5b176e8d6..31236abd75680 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):