Ch3_PrecisionScore/Recall_score _ Zero division problem
- 主要语言
- Jupyter Notebook
- 星标
- 30k
- 派生
- 13.1k
- PR 合并指标
- 30 天内没有已合并 PR
描述
I tried running this code:
# If we set a threshold of 70000 based on some precision criteria (say around 90%)
y_train_pred_90 = (y_scores > 70000)
from sklearn.metrics import precision_score, recall_score
print(precision_score(y_train_5, y_train_pred_90))) # output?: 0
#UndefinedMetricWarning: Precision is ill-defined and being set to 0.0 due to no predicted samples. Use `zero_division`
parameter to control this behavior.
recall_score(y_train_5, y_train_pred_90) # returning 0
# https://github.com/scikit-learn/scikit-learn/issues/14876#issuecomment-527879372
# https://stackoverflow.com/a/47285662/5114585
I understand that sometimes denominator becomes zero and we get these warnings & we can set default value to be 0 or 1 [https://scikit-learn.org/stable/modules/generated/sklearn.metrics.precision_score.html]
My questions:
1. My results are not matching from the book [below results from book].
>>> precision_score(y_train_5, y_train_pred_90)
0.8998702983138781
>>> recall_score(y_train_5, y_train_pred_90)
0.63991883416343853
2. Better ways to handle this issue?
Setting different threshold, ignoring the labels which were not predicted [https://stackoverflow.com/a/47285662/5114585](url)
something else?
贡献指南
这个仓库没有索引到贡献指南
评估
这个 Issue 还没有评估数据。