boot.ci() 无法计算 F1 分数的置信区间



我正在尝试使用R中的引导包计算F1分数的置信区间。但它似乎不起作用,我不知道为什么。

library(MLmetrics)
fci<-function(data,indices,x,y){
d<-data[indices,]
r<-F1_Score(x,y)
r
}
set.seed(12345)
bootout<-boot(data=test,
x=test$jbz,
y=test$`DR_ai+jd`,
R=2000,
statistic=fci
)
boot.ci(bootout)

错误:

[1] "All values of t are equal to  0.996637873066777 n Cannot calculate confidence intervals"
NULL
library(MLmetrics)
library(boot)
set.seed(12345)
fci<-function(data,indices,x,y){
d<-as.data.frame(data[indices,])
r<-F1_Score(d[,1],d[,2],positive=1)
r
}
bootout<-boot(data=test,
x=test$jbz,
y=test$`DR_ai+jd`,
R=2000,
statistic=fci
)
boot.ci(bootout,type="basic")
F1_Score(y_true = test$jbz, y_pred = test$`DR_ai+jd`,positive="1")

这个效果很好~~

最新更新