Search code examples
rsvmnaivebayesquanteda

Quanteda text models: Is it possible to calculate AUC and plot ROC curves for svm and naive Bayes?


I am using svm and Naive Bayes algorithms from quanteda text models package. Is it possible to calculate AUC and plot ROC curves? I would be grateful if you suggest any example tutorial.


Solution

  • I used something like this and it worked. I am grateful for Ken Benoit's response in the comments.

    nb_quanteda.prob <- predict(tmod_nb,type="probability",  newdata = dfmat_unknown_matched)  
    pred_nb_qaunteda <- prediction(as.numeric(nb_quanteda.prob[,-1]), Truth)  
    perf_nb_qaunteda <- performance(pred_nb_qaunteda,"tpr","fpr")  
    plot( perf_nb_qaunteda, col="darkblue", main="Roc nb")