Skip to content

Commit bb28e82

Browse files
embanderaogrisel
andauthored
DOC Ensures that GenericUnivariateSelect passes numpydoc validation (scikit-learn#20495)
Co-authored-by: Olivier Grisel <[email protected]>
1 parent 5c49994 commit bb28e82

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

maint_tools/test_docstrings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
"GaussianNB",
4343
"GaussianProcessRegressor",
4444
"GaussianRandomProjection",
45-
"GenericUnivariateSelect",
4645
"GradientBoostingClassifier",
4746
"GradientBoostingRegressor",
4847
"GraphicalLasso",

sklearn/feature_selection/_univariate_selection.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ def fit(self, X, y):
392392
Returns
393393
-------
394394
self : object
395+
Returns the instance itself.
395396
"""
396397
X, y = self._validate_data(
397398
X, y, accept_sparse=["csr", "csc"], multi_output=True
@@ -860,18 +861,6 @@ class GenericUnivariateSelect(_BaseFilter):
860861
861862
.. versionadded:: 0.24
862863
863-
Examples
864-
--------
865-
>>> from sklearn.datasets import load_breast_cancer
866-
>>> from sklearn.feature_selection import GenericUnivariateSelect, chi2
867-
>>> X, y = load_breast_cancer(return_X_y=True)
868-
>>> X.shape
869-
(569, 30)
870-
>>> transformer = GenericUnivariateSelect(chi2, mode='k_best', param=20)
871-
>>> X_new = transformer.fit_transform(X, y)
872-
>>> X_new.shape
873-
(569, 20)
874-
875864
See Also
876865
--------
877866
f_classif : ANOVA F-value between label/feature for classification tasks.
@@ -885,6 +874,18 @@ class GenericUnivariateSelect(_BaseFilter):
885874
SelectFpr : Select features based on a false positive rate test.
886875
SelectFdr : Select features based on an estimated false discovery rate.
887876
SelectFwe : Select features based on family-wise error rate.
877+
878+
Examples
879+
--------
880+
>>> from sklearn.datasets import load_breast_cancer
881+
>>> from sklearn.feature_selection import GenericUnivariateSelect, chi2
882+
>>> X, y = load_breast_cancer(return_X_y=True)
883+
>>> X.shape
884+
(569, 30)
885+
>>> transformer = GenericUnivariateSelect(chi2, mode='k_best', param=20)
886+
>>> X_new = transformer.fit_transform(X, y)
887+
>>> X_new.shape
888+
(569, 20)
888889
"""
889890

890891
_selection_modes: dict = {

0 commit comments

Comments
 (0)