8000 Update _scorer.py by helper-uttam · Pull Request #20316 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

Update _scorer.py #20316

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

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 8 additions & 0 deletions sklearn/metrics/_scorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
brier_score_loss,
jaccard_score,
mean_absolute_percentage_error,
root_mean_squared_log_error,
)

from .cluster import adjusted_rand_score
Expand Down Expand Up @@ -585,6 +586,10 @@ def make_scorer(
needs_threshold=False,
**kwargs,
):

def root_mean_squared_log_error(y_true, y_preds):
return np.sqrt(mean_squared_log_error(y_test, y_preds))

"""Make a scorer from a performance metric or loss function.

This factory function wraps scoring functions for use in
Expand Down Expand Up @@ -690,6 +695,9 @@ def make_scorer(
neg_mean_absolute_percentage_error_scorer = make_scorer(
mean_absolute_percentage_error, greater_is_better=False
)
neg_root_mean_squared_log_error_scorer = make_scorer(
root_mean_squared_log_error, greater_is_better=False
)
neg_median_absolute_error_scorer = make_scorer(
median_absolute_error, greater_is_better=False
)
Expand Down
0