Skip to content

DOC Ensures that GenericUnivariateSelect passes numpydoc validation #20495

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion maint_tools/test_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"GaussianNB",
"GaussianProcessRegressor",
"GaussianRandomProjection",
"GenericUnivariateSelect",
"GradientBoostingClassifier",
"GradientBoostingRegressor",
"GraphicalLasso",
Expand Down
25 changes: 13 additions & 12 deletions sklearn/feature_selection/_univariate_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ def fit(self, X, y):
Returns
-------
self : object
Returns the instance itself.
"""
X, y = self._validate_data(
X, y, accept_sparse=["csr", "csc"], multi_output=True
Expand Down Expand Up @@ -860,18 +861,6 @@ class GenericUnivariateSelect(_BaseFilter):

.. versionadded:: 0.24

Examples
--------
>>> from sklearn.datasets import load_breast_cancer
>>> from sklearn.feature_selection import GenericUnivariateSelect, chi2
>>> X, y = load_breast_cancer(return_X_y=True)
>>> X.shape
(569, 30)
>>> transformer = GenericUnivariateSelect(chi2, mode='k_best', param=20)
>>> X_new = transformer.fit_transform(X, y)
>>> X_new.shape
(569, 20)

See Also
--------
f_classif : ANOVA F-value between label/feature for classification tasks.
Expand All @@ -885,6 +874,18 @@ class GenericUnivariateSelect(_BaseFilter):
SelectFpr : Select features based on a false positive rate test.
SelectFdr : Select features based on an estimated false discovery rate.
SelectFwe : Select features based on family-wise error rate.

Examples
--------
>>> from sklearn.datasets import load_breast_cancer
>>> from sklearn.feature_selection import GenericUnivariateSelect, chi2
>>> X, y = load_breast_cancer(return_X_y=True)
>>> X.shape
(569, 30)
>>> transformer = GenericUnivariateSelect(chi2, mode='k_best', param=20)
>>> X_new = transformer.fit_transform(X, y)
>>> X_new.shape
(569, 20)
"""

_selection_modes: dict = {
Expand Down