![](/img/trans.png)
[英]Plotting a linear discriminant analysis, classification tree and Naive Bayes Curve on a single ROC plot
[英]Roc curve in linear discriminant analysis with R
我想计算 Roc 曲线,然后从线性判别模型计算 AUC。 你知道我该怎么做吗? 这里有代码:
##LDA
require(MASS)
library(MASS)
lda.fit = lda(Negative ~., trainSparse)
lda.fit
plot(lda.fit)
###prediction on the test set
lda.pred=predict(lda.fit,testSparse)
table(testSparse$Negative,lda.pred$class)
我会这样做。 因为在这里你也得到了 AUC 测量 + 看起来超级精干和光滑
install.packages("pROC")
library(pROC)
par(pty = "s")
roc(testSparse$Negative,lda.pred$posterior[,2],plot=TRUE, legacy.axes = TRUE,
percent =TRUE, xlab="False Positive Percentage", ylab="True Positive Percentage")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.