Okay, let's break this down for a balanced dataset where the number of positive instances (P) equals the number of negative instances (N). Let the total number of instances be Total = P + N. Since it's balanced, P = N = Total / 2.
A random predictor (in the most common interpretation for a binary classification problem) will guess "positive" or "negative" with a certain probability, independent of the actual features.
Let's assume the most straightforward random predictor: one that predicts "positive" 50% of the time and "negative" 50% of the time, at random.
-
True Positives (TP):
- Actual positives in the dataset:
P = Total / 2.
- The predictor randomly guesses "positive" for 50% of these.
- So,
TP = (Total / 2) * 0.5 = Total / 4.
-
False Positives (FP):
- Actual negatives in the dataset:
N = Total / 2.
- The predictor randomly guesses "positive" (incorrectly) for 50% of these.
- So,
FP = (Total / 2) * 0.5 = Total / 4.
-
False Negatives (FN):
- Actual positives in the dataset:
P = Total / 2.
- The predictor randomly guesses "negative" (incorrectly) for 50% of these.
- So,
FN = (Total / 2) * 0.5 = Total / 4.
-
True Negatives (TN):
- Actual negatives in the dataset:
N = Total / 2.
- The predictor randomly guesses "negative" for 50% of these.
- So,
TN = (Total / 2) * 0.5 = Total / 4.
Now let's calculate the metrics:
-
Precision: TP / (TP + FP)
- Precision =
(Total / 4) / (Total / 4 + Total / 4)
- Precision =
(Total / 4) / (Total / 2)
- Precision =
1/2 = **0.5**
-
Recall (True Positive Rate, TPR): TP / (TP + FN)
- Recall =
(Total / 4) / (Total / 4 + Total / 4)
- Recall =
(Total / 4) / (Total / 2)
- Recall =
1/2 = **0.5**
-
False Positive Rate (FPR): FP / (FP + TN)
- FPR =
(Total / 4) / (Total / 4 + Total / 4)
- FPR =
(Total / 4) / (Total / 2)
- FPR =
1/2 = **0.5**
Therefore, for a balanced dataset and a random predictor that guesses "positive" 50% of the time:
- Precision = 0.5
- Recall = 0.5
- FPR = 0.5
Important Caveat:
If the "random predictor" doesn't predict positive 50% of the time, but rather predicts positive with some other probability q (e.g., it always predicts positive, so q=1, or it predicts positive 10% of the time, so q=0.1):
TP = P * q = (Total / 2) * q
FP = N * q = (Total / 2) * q
FN = P * (1-q) = (Total / 2) * (1-q)
TN = N * (1-q) = (Total / 2) * (1-q)
Then:
- Precision:
TP / (TP + FP) = ((Total/2)*q) / ((Total/2)*q + (Total/2)*q) = ((Total/2)*q) / (Total*q) = 1/2 = **0.5**
- (As long as
q > 0. If q=0, TP and FP are 0, and precision is undefined or considered 0 by some conventions).
- This is because, for a balanced dataset, regardless of how many predictions are "positive", half of them will be TPs and half FPs by chance.
- Recall (TPR):
TP / (TP + FN) = ((Total/2)*q) / ((Total/2)*q + (Total/2)*(1-q)) = ((Total/2)*q) / (Total/2) = **q**
- FPR:
FP / (FP + TN) = ((Total/2)*q) / ((Total/2)*q + (Total/2)*(1-q)) = ((Total/2)*q) / (Total/2) = **q**
So, in this more general case:
- Precision = 0.5 (for
q > 0)
- Recall =
q
- FPR =
q
However, when people refer to a "random predictor" baseline on a balanced dataset without further qualification, they usually imply the q=0.5 scenario, leading to 0.5 for all three metrics. This is because it aligns with the class prevalence.