After I plotted ROC and printed out the portion of values that I think it balances True Positive and False Positive. Say below.
> head(roc_df[roc_df$fpp > 20 & roc_df$fpp < 40,])
tpp fpp thresholds
26 86.44068 38.70968 0.5125
27 86.44068 35.48387 0.5300
28 84.74576 35.48387 0.5370
29 83.05085 35.48387 0.5475
30 83.05085 32.25806 0.5570
31 81.35593 32.25806 0.5610
and I think 0.5300 is actually quite good and I have the probability prediction of two classes below
> rf_prob_df
0 1
190 0.696 0.304
265 0.847 0.153
191 0.154 0.846
122 0.167 0.833
423 0.465 0.535
I'm not sure how I can apply a new threshold to predict class based on the probability there.
- Do I use my threshold, 0.5300, on one of the columns? If so, which one do I use?
- If I use it on both columns, I predict class based on the probability that exceed the threshold. For example, first row is 0.696>0.5300, then I predict 0 as my class? What if I ran into 0.500 and 0.500 for both classes how do I make the prediction?