Introduction:
The F- beta measure is an evaluation metric for a Classification model.
In the terms of data science, “It is the weighted harmonic mean of Precision and Recall.” But in easier way, F- beta score is a generalized value of F1 score with beta parameter = 1, having its value of a minimum of 0 and a maximum of 1.
When the F-beta score of your machine learning model approaches 1, it indicates that the model has been successfully trained; when it approaches 0, it indicates that the model has not been effectively trained.
The beta parameter determines the weight of recall in the combined score. Both Precision and Recall are important, but sometimes one is a bit more important than the other.
If Precision has more weight than Recall, then we say beta < 1.
If Recall has more weight than Precision, then we say beta > 1.
Now the question arises, which metric Precision or Recall has the higher priority?
The straightforward answer to this question is priority depends on the business problem.
Let us discuss on two cases in which we can prioritize Precision and Recall in a scenario.
Case 1:
A case might be where minimizing false positives is more important than minimizing false negatives.
Now consider an example, there are two classes, good email (0) and spam email (1).
It is very important that a good email (0) should not be wrongly classified as a spam email (1), hence we need to reduce falsely spam or false positives.
Let us take another case.
Case 2:
A case might be where minimizing false negatives is more important than minimizing false positives.
Now consider an example, there are two classes, safe weapon (0) and dangerous weapon (1).
It is very important that a dangerous weapon (1) should not pass the weapon security check, and wrongly classified as a safe weapon (0), hence we need to reduce falsely safe or false negatives.
By discussing these two scenarios, we can conclude that:
1. If FP is more important, then we Decrease Beta value, i.e. (Beta < 1). 2. If FN is more important then we Increase Beta value, i.e. (Beta > 1).
3. If both FP & FN are important then we use F- Beta = 1.
Code Implimentation:
Now from this code above, we can see that the F- beta score = 0.958.