8000 MAINT Parameter validation for metrics.cluster.fowlkes_mallows_score … · scikit-learn/scikit-learn@2a24e67 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2a24e67

Browse files
MAINT Parameter validation for metrics.cluster.fowlkes_mallows_score (#26080)
Co-authored-by: jeremiedbb <jeremiedbb@yahoo.fr>
1 parent fb52671 commit 2a24e67

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

sklearn/metrics/cluster/_supervised.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,6 +1093,13 @@ def normalized_mutual_info_score(
10931093
return mi / normalizer
10941094

10951095

1096+
@validate_params(
1097+
{
1098+
"labels_true": ["array-like"],
1099+
"labels_pred": ["array-like"],
1100+
"sparse": ["boolean"],
1101+
}
1102+
)
10961103
def fowlkes_mallows_score(labels_true, labels_pred, *, sparse=False):
10971104
"""Measure the similarity of two clusterings of a set of points.
10981105
@@ -1118,10 +1125,10 @@ def fowlkes_mallows_score(labels_true, labels_pred, *, sparse=False):
11181125
11191126
Parameters
11201127
----------
1121-
labels_true : int array, shape = (``n_samples``,)
1128+
labels_true : array-like of shape (n_samples,), dtype=int
11221129
A clustering of the data into disjoint subsets.
11231130
1124-
labels_pred : array, shape = (``n_samples``, )
1131+
labels_pred : array-like of shape (n_samples,), dtype=int
11251132
A clustering of the data into disjoint subsets.
11261133
11271134
sparse : bool, default=False

sklearn/tests/test_public_functions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ def _check_function_param_validation(
170170
"sklearn.metrics.classification_report",
171171
"sklearn.metrics.cluster.adjusted_mutual_info_score",
172172
"sklearn.metrics.cluster.contingency_matrix",
173+
"sklearn.metrics.cluster.fowlkes_mallows_score",
173174
"sklearn.metrics.cluster.normalized_mutual_info_score",
174175
"sklearn.metrics.cluster.silhouette_samples",
175176
"sklearn.metrics.cluster.silhouette_score",

0 commit comments

Comments
 (0)
0