【问题标题】:Quanteda text models: Is it possible to calculate AUC and plot ROC curves for svm and naive Bayes?Quanteda 文本模型:是否可以为 svm 和朴素贝叶斯计算 AUC 并绘制 ROC 曲线?
【发布时间】:2021-03-01 12:27:49
【问题描述】:

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

【问题讨论】:

  • 不属于 quanteda.textmodels 包的一部分,至少截至 2020 年 11 月不属于。我们正在努力扩展此功能,但目前,您需要运行不同的模型并自己计算。

标签: r svm naivebayes quanteda


【解决方案1】:

我用过这样的东西,它奏效了。我很感谢 Ken Benoit 在 cmets 中的回应。

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

【讨论】:

  • 请接受您自己的答案 - 这没有错(相反,我们鼓励这样做)。
猜你喜欢
  • 2016-01-18
  • 2017-08-25
  • 2013-09-09
  • 2016-08-26
  • 1970-01-01
  • 2015-12-18
  • 2016-02-02
  • 2015-03-06
  • 2014-09-18
相关资源
最近更新 更多