1
$\begingroup$

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?
$\endgroup$

1 Answer 1

3
$\begingroup$

The two columns you see are the predicted probabilities for class 0 and class 1.

The ROC result you have, the threshold is based on the positive probability. You can obtain the predicted label using a threshold of 0.53:

ifelse(rf_prob_df[,2]>0.53,10)

If the probability of 1 is 0.5 or say below 0.53, then the predicted class, with your new threshold, will be 0.

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.