Quanteda 文本模型:是否可以计算 AUC 并绘制 svm 和朴素贝叶斯的 ROC 曲线?

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

我正在使用 quanteda text models 包中的 svmNaive Bayes 算法。是否可以计算 AUC 并绘制 ROC curves?如果您推荐任何示例教程,我将不胜感激。

我用过这样的东西,它起作用了。感谢 Ken Benoit 在评论中的回复。

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")