Skip to content

Commit 58ed58d

Browse files
authored
DOC Ensures that SelectFdr passes numpydoc validation (scikit-learn#20984)
1 parent 6568222 commit 58ed58d

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

maint_tools/test_docstrings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
"RobustScaler",
6161
"SGDOneClassSVM",
6262
"SGDRegressor",
63-
"SelectFdr",
6463
"SelectFpr",
6564
"SelectFromModel",
6665
"SelectFwe",

sklearn/feature_selection/_univariate_selection.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ def _get_support_mask(self):
699699

700700

701701
class SelectFdr(_BaseFilter):
702-
"""Filter: Select the p-values for an estimated false discovery rate
702+
"""Filter: Select the p-values for an estimated false discovery rate.
703703
704704
This uses the Benjamini-Hochberg procedure. ``alpha`` is an upper bound
705705
on the expected false discovery rate.
@@ -717,17 +717,6 @@ class SelectFdr(_BaseFilter):
717717
alpha : float, default=5e-2
718718
The highest uncorrected p-value for features to keep.
719719
720-
Examples
721-
--------
722-
>>> from sklearn.datasets import load_breast_cancer
723-
>>> from sklearn.feature_selection import SelectFdr, chi2
724-
>>> X, y = load_breast_cancer(return_X_y=True)
725-
>>> X.shape
726-
(569, 30)
727-
>>> X_new = SelectFdr(chi2, alpha=0.01).fit_transform(X, y)
728-
>>> X_new.shape
729-
(569, 16)
730-
731720
Attributes
732721
----------
733722
scores_ : array-like of shape (n_features,)
@@ -747,10 +736,6 @@ class SelectFdr(_BaseFilter):
747736
748737
.. versionadded:: 1.0
749738
750-
References
751-
----------
752-
https://en.wikipedia.org/wiki/False_discovery_rate
753-
754739
See Also
755740
--------
756741
f_classif : ANOVA F-value between label/feature for classification tasks.
@@ -765,6 +750,21 @@ class SelectFdr(_BaseFilter):
765750
SelectFwe : Select features based on family-wise error rate.
766751
GenericUnivariateSelect : Univariate feature selector with configurable
767752
mode.
753+
754+
References
755+
----------
756+
https://en.wikipedia.org/wiki/False_discovery_rate
757+
758+
Examples
759+
--------
760+
>>> from sklearn.datasets import load_breast_cancer
761+
>>> from sklearn.feature_selection import SelectFdr, chi2
762+
>>> X, y = load_breast_cancer(return_X_y=True)
763+
>>> X.shape
764+
(569, 30)
765+
>>> X_new = SelectFdr(chi2, alpha=0.01).fit_transform(X, y)
766+
>>> X_new.shape
767+
(569, 16)
768768
"""
769769

770770
def __init__(self, score_func=f_classif, *, alpha=5e-2):

0 commit comments

Comments
 (0)