Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

MAINT Parameters validation for metrics.classification_report #25868

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from Mar 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion 17 sklearn/metrics/_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -2350,6 +2350,21 @@ def balanced_accuracy_score(y_true, y_pred, *, sample_weight=None, adjusted=Fals
return score


@validate_params(
{
"y_true": ["array-like", "sparse matrix"],
"y_pred": ["array-like", "sparse matrix"],
"labels": ["array-like", None],
"target_names": ["array-like", None],
"sample_weight": ["array-like", None],
"digits": [Interval(Integral, 0, None, closed="left")],
"output_dict": ["boolean"],
"zero_division": [
Options(Real, {0, 1}),
StrOptions({"warn"}),
],
}
)
def classification_report(
y_true,
y_pred,
Expand All @@ -2376,7 +2391,7 @@ def classification_report(
labels : array-like of shape (n_labels,), default=None
Optional list of label indices to include in the report.

target_names : list of str of shape (n_labels,), default=None
target_names : array-like of shape (n_labels,), default=None
Optional display names matching the labels (same order).

sample_weight : array-like of shape (n_samples,), default=None
Expand Down
1 change: 1 addition & 0 deletions 1 sklearn/tests/test_public_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ def _check_function_param_validation(
"sklearn.metrics.balanced_accuracy_score",
"sklearn.metrics.brier_score_loss",
"sklearn.metrics.class_likelihood_ratios",
"sklearn.metrics.classification_report",
"sklearn.metrics.cluster.contingency_matrix",
"sklearn.metrics.cohen_kappa_score",
"sklearn.metrics.confusion_matrix",
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.