Skip to content

Commit

Permalink
MAINT Parameters validation for sklearn.metrics.adjusted_rand_score (s…
Browse files Browse the repository at this point in the history
…cikit-learn#26134)

Co-authored-by: Jérémie du Boisberranger <[email protected]>
  • Loading branch information
jiawei-zhang-a and jeremiedbb committed Apr 12, 2023
1 parent c8fb561 commit 3023f19
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions sklearn/metrics/cluster/_supervised.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,12 @@ def rand_score(labels_true, labels_pred):
return numerator / denominator


@validate_params(
{
"labels_true": ["array-like"],
"labels_pred": ["array-like"],
}
)
def adjusted_rand_score(labels_true, labels_pred):
"""Rand index adjusted for chance.
Expand Down Expand Up @@ -352,10 +358,10 @@ def adjusted_rand_score(labels_true, labels_pred):
Parameters
----------
labels_true : int array, shape = [n_samples]
labels_true : array-like of shape (n_samples,), dtype=int
Ground truth class labels to be used as a reference.
labels_pred : array-like of shape (n_samples,)
labels_pred : array-like of shape (n_samples,), dtype=int
Cluster labels to evaluate.
Returns
Expand Down
1 change: 1 addition & 0 deletions sklearn/tests/test_public_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ def _check_function_param_validation(
"sklearn.metrics.mutual_info_score",
"sklearn.metrics.ndcg_score",
"sklearn.metrics.pair_confusion_matrix",
"sklearn.metrics.adjusted_rand_score",
"sklearn.metrics.pairwise.additive_chi2_kernel",
"sklearn.metrics.pairwise.cosine_distances",
"sklearn.metrics.pairwise.cosine_similarity",
Expand Down

0 comments on commit 3023f19

Please sign in to comment.