【问题标题】:boot.ci() can't compute confidence intervals for F1 scoreboot.ci() 无法计算 F1 分数的置信区间
【发布时间】:2020-11-28 09:13:27
【问题描述】:

我正在尝试使用 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

【问题讨论】:

    标签: statistics-bootstrap


    【解决方案1】:
    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")
    

    这个很好用~~

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-23
      • 2011-05-28
      • 2014-08-31
      相关资源
      最近更新 更多