-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Implement RMSE (root-mean-square error) metric and scorer #13467
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
Conversation
As per my understanding, I have added the scorer. Let me know if I missed something. |
there're still some pep8 errors, please refer to https://circleci.com/gh/scikit-learn/scikit-learn/52068 |
Please add the new scorer to https://scikit-learn.org/dev/modules/model_evaluation.html#common-cases-predefined-values |
I think we need more tests, e.g., test_regression_multioutput_array and test_regression_metrics_at_limits. |
May I try continuing work on this? |
@xinyuliu12 Actually I am waiting for a review on this. Also, I am not sure about the doc failures in the commit so if you want you can help with that. @qinhanmin2014 Could you please review and let me know if any changes required. |
@urvang96 Merge with master should fix the doc tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add an entry to the change log at doc/whats_new/v*.rst
. Like the other entries there, please reference this pull request with :pr:
and credit yourself (and other contributors if applicable) with :user:
.
@qinhanmin2014 Added the changes in whats_new. Thank you. |
sklearn/metrics/regression.py
Outdated
@@ -253,7 +260,11 @@ def mean_squared_error(y_true, y_pred, | |||
# pass None as weights to np.average: uniform mean | |||
multioutput = None | |||
|
|||
return np.average(output_errors, weights=multioutput) | |||
mse = np.average(output_errors, weights=multioutput) | |||
if not squared: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit:
return mse if squared else np.sqrt(mse)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thomasjpfan Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM as well, thanks @urvang96 !
Reference Issues/PRs
Fixes #12895
Implement RMSE (root-mean-square error) metric and scorer
What does this implement/fix? Explain your changes.
Added a boolean parameter in MSE implementation to return RMSE value, if set to true. Also added an RMSE scorer.
Any other comments?
One test.