还是StackOverflow:here
原话:
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.
意思很明确:precision等于0,recall也是0.所以0/0报错了,就是说positive的个数是0.