Skip to content

MAINT Parameter Validation for feature_selection.f_classif() #25720

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 3 commits into from
Feb 28, 2023
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
8 changes: 7 additions & 1 deletion sklearn/feature_selection/_univariate_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ def f_oneway(*args):
return f, prob


@validate_params(
{
"X": ["array-like", "sparse matrix"],
"y": ["array-like"],
}
)
def f_classif(X, y):
"""Compute the ANOVA F-value for the provided sample.

Expand All @@ -127,7 +133,7 @@ def f_classif(X, y):
X : {array-like, sparse matrix} of shape (n_samples, n_features)
The set of regressors that will be tested sequentially.

y : ndarray of shape (n_samples,)
y : array-like of shape (n_samples,)
The target vector.

Returns
Expand Down
1 change: 1 addition & 0 deletions sklearn/tests/test_public_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ def _check_function_param_validation(
"sklearn.feature_extraction.image.extract_patches_2d",
"sklearn.feature_extraction.image.reconstruct_from_patches_2d",
"sklearn.feature_selection.chi2",
"sklearn.feature_selection.f_classif",
"sklearn.metrics.accuracy_score",
"sklearn.metrics.auc",
"sklearn.metrics.average_precision_score",
Expand Down