美文网首页
常见预测模型

常见预测模型

作者: 浮出海面_d825 | 来源:发表于2022-06-27 16:28 被阅读0次

    Lasso:https://cloud.tencent.com/developer/article/1621581

    岭回归:https://cloud.tencent.com/developer/article/1664071

    弹性网络(这个国外网站可以学着):https://daviddalpiaz.github.io/r4sl/elastic-net.html

    performace函数

    
    #函数performance
    
    performance <- function(table, n=2){
    
      if(!all(dim(table) == c(2,2)))
    
        stop("Must be a 2 x 2 table")
    
      tn = table[1,1]
    
      fp = table[1,2]
    
      fn = table[2,1]
    
      tp = table[2,2]
    
      sensitivity = tp/(tp+fn)
    
      specificity = tn/(tn+fp)
    
      ppp = tp/(tp+fp)
    
      npp = tn/(tn+fn)
    
      hitrate = (tp+tn)/(tp+tn+fp+fn)
    
      result <- paste("Sensitivity = ", round(sensitivity, n) ,
    
                      "\nSpecificity = ", round(specificity, n),
    
                      "\nPositive Predictive Value = ", round(ppp, n),
    
                      "\nNegative Predictive Value = ", round(npp, n),
    
                      "\nAccuracy = ", round(hitrate, n), "\n", sep="")
    
      cat(result)
    
    }

    相关文章

      网友评论

          本文标题:常见预测模型

          本文链接:https://www.haomeiwen.com/subject/scqovrtx.html