Skip to content

Commit 6568222

Browse files
authored
DOC Ensures that SelectKBest passes numpydoc validation (scikit-learn#20983)
1 parent 3aab975 commit 6568222

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
@@ -64,7 +64,6 @@
6464
"SelectFpr",
6565
"SelectFromModel",
6666
"SelectFwe",
67-
"SelectKBest",
6867
"SelfTrainingClassifier",
6968
"SequentialFeatureSelector",
7069
"SimpleImputer",

sklearn/feature_selection/_univariate_selection.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -563,22 +563,6 @@ class SelectKBest(_BaseFilter):
563563
564564
.. versionadded:: 1.0
565565
566-
Examples
567-
--------
568-
>>> from sklearn.datasets import load_digits
569-
>>> from sklearn.feature_selection import SelectKBest, chi2
570-
>>> X, y = load_digits(return_X_y=True)
571-
>>> X.shape
572-
(1797, 64)
573-
>>> X_new = SelectKBest(chi2, k=20).fit_transform(X, y)
574-
>>> X_new.shape
575-
(1797, 20)
576-
577-
Notes
578-
-----
579-
Ties between features with equal scores will be broken in an unspecified
580-
way.
581-
582566
See Also
583567
--------
584568
f_classif: ANOVA F-value between label/feature for classification tasks.
@@ -593,6 +577,22 @@ class SelectKBest(_BaseFilter):
593577
SelectFwe : Select features based on family-wise error rate.
594578
GenericUnivariateSelect : Univariate feature selector with configurable
595579
mode.
580+
581+
Notes
582+
-----
583+
Ties between features with equal scores will be broken in an unspecified
584+
way.
585+
586+
Examples
587+
--------
588+
>>> from sklearn.datasets import load_digits
589+
>>> from sklearn.feature_selection import SelectKBest, chi2
590+
>>> X, y = load_digits(return_X_y=True)
591+
>>> X.shape
592+
(1797, 64)
593+
>>> X_new = SelectKBest(chi2, k=20).fit_transform(X, y)
594+
>>> X_new.shape
595+
(1797, 20)
596596
"""
597597

598598
def __init__(self, score_func=f_classif, *, k=10):

0 commit comments

Comments
 (0)