|
15 | 15 | from scipy import sparse as sp
|
16 | 16 |
|
17 | 17 | from ...utils._array_api import _max_precision_float_dtype, get_namespace_and_device
|
18 |
| -from ...utils._param_validation import Interval, StrOptions, validate_params |
| 18 | +from ...utils._param_validation import Hidden, Interval, StrOptions, validate_params |
19 | 19 | from ...utils.multiclass import type_of_target
|
20 | 20 | from ...utils.validation import check_array, check_consistent_length
|
21 | 21 | from ._expected_mutual_info_fast import expected_mutual_information
|
@@ -1178,11 +1178,11 @@ def normalized_mutual_info_score(
|
1178 | 1178 | {
|
1179 | 1179 | "labels_true": ["array-like"],
|
1180 | 1180 | "labels_pred": ["array-like"],
|
1181 |
| - "sparse": ["boolean"], |
| 1181 | + "sparse": ["boolean", Hidden(StrOptions({"deprecated"}))], |
1182 | 1182 | },
|
1183 | 1183 | prefer_skip_nested_validation=True,
|
1184 | 1184 | )
|
1185 |
| -def fowlkes_mallows_score(labels_true, labels_pred, *, sparse=False): |
| 1185 | +def fowlkes_mallows_score(labels_true, labels_pred, *, sparse="deprecated"): |
1186 | 1186 | """Measure the similarity of two clusterings of a set of points.
|
1187 | 1187 |
|
1188 | 1188 | .. versionadded:: 0.18
|
@@ -1216,6 +1216,10 @@ def fowlkes_mallows_score(labels_true, labels_pred, *, sparse=False):
|
1216 | 1216 | sparse : bool, default=False
|
1217 | 1217 | Compute contingency matrix internally with sparse matrix.
|
1218 | 1218 |
|
| 1219 | + .. deprecated:: 1.7 |
| 1220 | + The ``sparse`` parameter is deprecated and will be removed in 1.9. It has |
| 1221 | + no effect. |
| 1222 | +
|
1219 | 1223 | Returns
|
1220 | 1224 | -------
|
1221 | 1225 | score : float
|
@@ -1249,6 +1253,14 @@ def fowlkes_mallows_score(labels_true, labels_pred, *, sparse=False):
|
1249 | 1253 | >>> fowlkes_mallows_score([0, 0, 0, 0], [0, 1, 2, 3])
|
1250 | 1254 | 0.0
|
1251 | 1255 | """
|
| 1256 | + # TODO(1.9): remove the sparse parameter |
| 1257 | + if sparse != "deprecated": |
| 1258 | + warnings.warn( |
| 1259 | + "The 'sparse' parameter was deprecated in 1.7 and will be removed in 1.9. " |
| 1260 | + "It has no effect. Leave it to its default value to silence this warning.", |
| 1261 | + FutureWarning, |
| 1262 | + ) |
| 1263 | + |
1252 | 1264 | labels_true, labels_pred = check_clusterings(labels_true, labels_pred)
|
1253 | 1265 | (n_samples,) = labels_true.shape
|
1254 | 1266 |
|
|
0 commit comments