why does scikitlearn says F1 score is ill-defined with FN bigger than 0?

后端 未结 2 1376
孤独总比滥情好
孤独总比滥情好 2020-12-08 04:19

I run a python program that calls sklearn.metrics\'s methods to calculate precision and F1 score. Here is the output when there is no predicted sample:

2条回答
  •  既然无缘
    2020-12-08 05:04

    https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/metrics/classification.py

    F1 = 2 * (precision * recall) / (precision + recall)

    precision = TP/(TP+FP) as you've just said if predictor doesn't predicts positive class at all - precision is 0.

    recall = TP/(TP+FN), in case if predictor doesn't predict positive class - TP is 0 - recall is 0.

    So now you are dividing 0/0.

提交回复
热议问题