calculateEqualError <- function( userScores, impostorScores ) {
predictions <- c( userScores, impostorScores );
labels <- c( rep( 0, length( userScores ) ),
rep( 1, length( impostorScores ) ) );
pred <- prediction( predictions, labels );
missrates <- pred@fn[[1]] / pred@n.pos[[1]];
farates <- pred@fp[[1]] / pred@n.neg[[1]];
# Find the point on the ROC with miss slightly >= fa, and the point
# next to it with miss slightly < fa.
dists <- missrates - farates;
idx1 <- which( dists == min( dists[ dists >= 0 ] ) );
idx2 <- which( dists == max( dists[ dists < 0 ] ) );
stopifnot( length( idx1 ) == 1 );
stopifnot( length( idx2 ) == 1 );
stopifnot( abs( idx1 - idx2 ) == 1 );
R语言注释,最好能转为matlab语言
答案:2 悬赏:40 手机版
解决时间 2021-12-23 10:20
- 提问者网友:萌卜娃娃
- 2021-12-23 01:20
最佳答案
- 五星知识达人网友:白昼之月
- 2021-12-23 02:33
y<-matrix(runif(1000*30),nrow=1000)
xm<-(rowMeans(y)-0.5)*sqrt(420)
x<-seq(-3,3,by=0.5)
F<-sum(sapply(x,function(y) xm<y))/1000
#F<-sum(c(xm< -3,xm< -2.5,xm< -2,xm< -1.5, xm< -1,xm< -0.5,xm<0,xm<0.5,xm<1,xm<1.5,xm<2,xm<2.5,xm<3))/1000
b<-pnorm(x) #b<-pnorm(seq(-3,3,by=0.5))
abs(b-F)
xm<-(rowMeans(y)-0.5)*sqrt(420)
x<-seq(-3,3,by=0.5)
F<-sum(sapply(x,function(y) xm<y))/1000
#F<-sum(c(xm< -3,xm< -2.5,xm< -2,xm< -1.5, xm< -1,xm< -0.5,xm<0,xm<0.5,xm<1,xm<1.5,xm<2,xm<2.5,xm<3))/1000
b<-pnorm(x) #b<-pnorm(seq(-3,3,by=0.5))
abs(b-F)
全部回答
- 1楼网友:北城痞子
- 2021-12-23 03:54
虽然我很聪明,但这么说真的难到我了
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯