8000 MAINT Parameters validation for sklearn.preprocessing.scale (#26036) · scikit-learn/scikit-learn@e166628 · GitHub
[go: up one dir, main page]

Skip to content

Commit e166628

Browse files
authored
MAINT Parameters validation for sklearn.preprocessing.scale (#26036)
1 parent 9202cea commit e166628

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

sklearn/preprocessing/_data.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,15 @@ def _handle_zeros_in_scale(scale, copy=True, constant_mask=None):
120120
return scale
121121

122122

123+
@validate_params(
124+
{
125+
"X": ["array-like", "sparse matrix"],
126+
"axis": [Options(Integral, {0, 1})],
127+
"with_mean": ["boolean"],
128+
"with_std": ["boolean"],
129+
"copy": ["boolean"],
130+
}
131+
)
123132
def scale(X, *, axis=0, with_mean=True, with_std=True, copy=True):
124133
"""Standardize a dataset along any axis.
125134
@@ -132,7 +141,7 @@ def scale(X, *, axis=0, with_mean=True, with_std=True, copy=True):
132141
X : {array-like, sparse matrix} of shape (n_samples, n_features)
133142
The data to center and scale.
134143
135-
axis : int, default=0
144+
axis : {0, 1}, default=0
136145
Axis used to compute the means and standard deviations along. If 0,
137146
independently standardize each feature, otherwise (if 1) standardize
138147
each sample.

sklearn/tests/test_public_functions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ def _check_function_param_validation(
210210
"sklearn.metrics.top_k_accuracy_score",
211211
"sklearn.metrics.zero_one_loss",
212212
"sklearn.model_selection.train_test_split",
213+
"sklearn.preprocessing.scale",
213214
"sklearn.random_projection.johnson_lindenstrauss_min_dim",
214215
"sklearn.svm.l1_min_c",
215216
"sklearn.tree.export_text",

0 commit comments

Comments
 (0)
0