1

I have built a model that gives me classification of some cases

here is a comparison between Actual and Prediction

Prediction   Actual
------------------------
    0          0
    0          0
    0          0
    0          0
    0          0
    0          0
    0          0
    0          0
    0          0

They all match and they all negative

when I try to get F1 Score for this case I get divided by zero

which makes sense as the Precision is TP / TP+FP (which all are zeros)

so in my case what would the F1 score be?

asmgx
  • 291
  • I think the existing answers to this question are a bit shortsighted. No, the F1 score cannot be calculated, but what is the “spirit” of what it “should” be? For instance, $\sin(x)/x$ is undefined at zero, yet we can make sense of the limit as $x$ approaches zero. Is there something similar? I feel this is a common enough situation and F1 a common enough measure of performance (despite its issues) to warrant a more detailed response than “can’t divide by zero”. – Dave Oct 01 '23 at 00:58

2 Answers2

0

In this case, you cannot calculate F1-score. You cannot also calculate precision and recall score. Use accuracy instead of them.

0

I think you already answered your question: Divided by Zero. F1-score is calculated from Precision and Recall. Your example only contains negative case. So you can't calculate positive related items(Precision). In human words: You don't have enough data to evaluate this model.