-
Notifications
You must be signed in to change notification settings - Fork 129
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
supress value error when label contains one label #157
supress value error when label contains one label #157
Conversation
Codecov Report
@@ Coverage Diff @@
## master #157 +/- ##
==========================================
+ Coverage 77.92% 78.57% +0.65%
==========================================
Files 79 80 +1
Lines 3388 3468 +80
==========================================
+ Hits 2640 2725 +85
+ Misses 748 743 -5 |
@@ -73,6 +74,10 @@ class ROCAUCEvaluator(Evaluator): | |||
are considered as negative. | |||
ignore_labels (int or list or None): labels to be ignored. | |||
`None` is used to not ignore all labels. | |||
raise_value_error (bool): If False, `ValueError` caused by | |||
`roc_auc_score` calculation is suppressed and ignored with warning |
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.
with a warning message.
@@ -73,6 +74,10 @@ class ROCAUCEvaluator(Evaluator): | |||
are considered as negative. | |||
ignore_labels (int or list or None): labels to be ignored. | |||
`None` is used to not ignore all labels. | |||
raise_value_error (bool): If False, `ValueError` caused by |
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.
enclose False
with backquotes.
else: | ||
# This is usually caused by the following | ||
# Only one class present in y_true. | ||
# ROC AUC score is not defined in that case |
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.
It describe when roc_auc_score
is raised. So I think we should move to l.145.
updated |
try: | ||
roc_auc = metrics.roc_auc_score(t_total, y_total) | ||
except ValueError as e: | ||
# `ValueError` is usually caused by the following |
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.
It seems you list only one situation where ValueError
is raised. So, by the following
seems strange.
roc_auc = metrics.roc_auc_score(t_total, y_total) | ||
except ValueError as e: | ||
# `ValueError` is usually caused by the following | ||
# Only one class present in y_true. |
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.
We should not capitalize here because the previous sentence is not completed.
ROCAUCEvaluator will raise ValueError when only one label is contained in the dataset. It has another benefit that we can make test example faster. |
Could you review @delta2323 @mottodora ? |
LGTM |
No description provided.