@@ -2127,7 +2127,7 @@ def _check_psd_eigenvalues(lambdas, enable_warnings=False):
2127
2127
2128
2128
2129
2129
def _check_sample_weight (
2130
- sample_weight , X , dtype = None , copy = False , ensure_non_negative = False
2130
+ sample_weight , X , * , dtype = None , ensure_non_negative = False , copy = False
2131
2131
):
2132
2132
"""Validate sample weights.
2133
2133
@@ -2144,18 +2144,22 @@ def _check_sample_weight(
2144
2144
X : {ndarray, list, sparse matrix}
2145
2145
Input data.
2146
2146
2147
+ dtype : dtype, default=None
2148
+ dtype of the validated `sample_weight`.
2149
+ If None, and `sample_weight` is an array:
2150
+
2151
+ - If `sample_weight.dtype` is one of `{np.float64, np.float32}`,
2152
+ then the dtype is preserved.
2153
+ - Else the output has NumPy's default dtype: `np.float64`.
2154
+
2155
+ If `dtype` is not `{np.float32, np.float64, None}`, then output will
2156
+ be `np.float64`.
2157
+
2147
2158
ensure_non_negative : bool, default=False,
2148
2159
Whether or not the weights are expected to be non-negative.
2149
2160
2150
2161
.. versionadded:: 1.0
2151
2162
2152
- dtype : dtype, default=None
2153
- dtype of the validated `sample_weight`.
2154
- If None, and the input `sample_weight` is an array, the dtype of the
2155
- input is preserved; otherwise an array with the default numpy dtype
2156
- is be allocated. If `dtype` is not one of `float32`, `float64`,
2157
- `None`, the output will be of dtype `float64`.
2158
-
2159
2163
copy : bool, default=False
2160
2164
If True, a copy of sample_weight will be created.
2161
2165
0 commit comments