0
$\begingroup$

How can I draw the roc curve of this model?

library(randomForest)
library(MASS)
training_set <- Boston

set.seed(500)
regressor =randomForest(medv ~ . , data = training_set,ntree=100) 
regressor

regressor

my_prediction = predict(regressor, test_set)
```
$\endgroup$
4
  • $\begingroup$ library(pROC);roc(...,smooth = TRUE,percent = TRUE,auc = TRUE,ci = TRUE,plot = TRUE) $\endgroup$
    – TPArrow
    Sep 18, 2019 at 11:44
  • $\begingroup$ can not understand the code? what is ....? could you connect it with above code $\endgroup$ Sep 18, 2019 at 11:55
  • $\begingroup$ @TPArrow: do you want to post your comment(s) as an answer? Better to have a short answer than no answer at all. Anyone who has a better answer can post it. $\endgroup$ Sep 18, 2019 at 11:59
  • $\begingroup$ @StephanKolassa Thanks. Well I guess the question is not proper for SE-CV then probably will be suspended and removed soon $\endgroup$
    – TPArrow
    Sep 18, 2019 at 12:33

1 Answer 1

2
$\begingroup$

With regards to your question about plotting the ROC curve from this code, there are at least two issues I can see:

  1. At least in the code you provided, there is no test_set from which to compute your predicted values in the last line. Perhaps you forgot to include it here, but if not, you definitely need to split the Boston data into both a training and testset at the beginning.

  2. More specific to the ROC curve, this plot is used to show the performance of a binary classifier, which from what I can tell from your code, is not your objective as the medv variable represents median household value in the Boston dataset. If you are indeed interested in medvas your primary outcome, perhaps look into performance metrics for continuous outcomes, namely, the loss functions such as MSE or RMSE to start.

If you're still interested in knowing more about ROC and how to plot them with R, I've found Rafael Irizarry's book chapter on this helpful.

Hope that helps.

$\endgroup$
3
  • $\begingroup$ so you say that ROC is not used for regression models, it is used for Classification Models? that was what I wondered about. is it ? $\endgroup$ Sep 18, 2019 at 12:43
  • $\begingroup$ Question 1 is right. I already have it. $\endgroup$ Sep 18, 2019 at 12:43
  • $\begingroup$ Thanks, +1. This is a very helpful answer. $\endgroup$ Sep 18, 2019 at 13:28

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