How to draw ROC curve using value of confusion matrix?

前端 未结 2 1709
小蘑菇
小蘑菇 2021-01-23 01:18

Consider i have a classifier like A and the result of its classification gives me the following table:

    TP  TN  FP  FN
A   225 100 175 100
         


        
2条回答
  •  灰色年华
    2021-01-23 02:01

    I don't understand why you'd simulate a new variable. You're basically asking to plot a curve from a single point, which is impossible. Instead, you should just use the dependent variable in the training or test data that you used to train the model. This will allow you to find a cutoff point that you consider optimal.

    The pROC package allows us to plot ROC curves easily. Assuming we have a data frame named test and a model named mymodel, we could use something like this:

    library('pROC')
    plot(roc(test$y, predict(mymodel, test, type = "prob"))
    

提交回复
热议问题