2
I need to plot a ROC curve in R, but I don’t know how to fix it.
cctrl2 <- trainControl(method = "cv", number = 10, classProbs = TRUE, savePredictions = TRUE)
modelNb <- train(Treino[, -5], Treino$TOTAL_PEDIDO,
method = "nb",
trControl = cctrl2)
test_class_pred_nb_probs <- predict(modelNb, Teste[, -5], type = "prob")
roc_nb = plot.roc(Teste[, 2],test_class_pred_nb_probs$alto, col='red')
However, the Test table$TOTAL_PEDIDO has 4 values (high, regular, low and min) and to plot the ROC curve the value must be atomic. So I did this.
aux<-Teste[which(Teste$TOTAL_PEDIDO == "alto"),]
test_class_pred_nb_probs <- predict(modelNb, aux[, -5], type = "prob")
roc_nb = plot.roc(aux[, 2],test_class_pred_nb_probs$alto, col='red')
And the message appears:
Error in sort.list(y) : 'x' must be atomic for 'sort.list'
Have you called 'Sort' on a list?
@Uzumakiartanis, translate? R asks if "called" the list sort function. And it was not called.
– PaulDaigle