Skip to content

Commit 7e15694

Browse files
MAINT Parameter Validation for feature_selection.f_classif (#25720)
Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com>
1 parent f9ee1b4 commit 7e15694

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

sklearn/feature_selection/_univariate_selection.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,12 @@ def f_oneway(*args):
117117
return f, prob
118118

119119

120+
@validate_params(
121+
{
122+
"X": ["array-like", "sparse matrix"],
123+
"y": ["array-like"],
124+
}
125+
)
120126
def f_classif(X, y):
121127
"""Compute the ANOVA F-value for the provided sample.
122128
@@ -127,7 +133,7 @@ def f_classif(X, y):
127133
X : {array-like, sparse matrix} of shape (n_samples, n_features)
128134
The set of regressors that will be tested sequentially.
129135
130-
y : ndarray of shape (n_samples,)
136+
y : array-like of shape (n_samples,)
131137
The target vector.
132138
133139
Returns

sklearn/tests/test_public_functions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ def _check_function_param_validation(
113113
"sklearn.feature_extraction.image.extract_patches_2d",
114114
"sklearn.feature_extraction.image.reconstruct_from_patches_2d",
115115
"sklearn.feature_selection.chi2",
116+
"sklearn.feature_selection.f_classif",
116117
"sklearn.metrics.accuracy_score",
117118
"sklearn.metrics.auc",
118119
"sklearn.metrics.average_precision_score",

0 commit comments

Comments
 (0)