WeightedROCããã±ã¼ã¸ã使ãã
æ¸å¼ã¯æ¬¡ã®éãã
WeightedROC(guess, label, weight = rep(1, length(label)))
- guess: ã¹ã³ã¢ã®æ°å¤ãã¯ãã«
- label: çæ£/è² ã©ãã«ãä¸æãª2ã¤ã®å¤ãæã¤å åãã¾ãã¯ãã¹ã¦ã®å¤ã0=ãã¤ãã¹,1=ãã©ã¹ã¾ãã¯1=ãã¤ãã¹,2=ãã©ã¹ã¾ãã¯-1=ãã¤ãã¹,1=ãã©ã¹ã®æ´æ°/æ°å¤ã
- weight: æ£ã®ã¦ã§ã¤ããããã©ã«ãã¯1ã
guessã«ã¯å°ºåº¦ã§æ¸¬ã£ãå¾ç¹ãlabelã«ã¯è¨ºæãweightã«ã¯ã¦ã§ã¤ãããããã
library(WeightedROC) ## ãã®éã¿ä»ãããããã¼ã¿ã»ããã®AUCãè¨ç®ãã y <- c(0, 0, 1, 1, 1) w <- c(1, 1, 1, 4, 5) y.hat <- c(1, 2, 3, 1, 1) tp.fp <- WeightedROC(y.hat, y, w) tp.fp
TPR FPR threshold FN FP 1 1.0 1.0 1 0 2 2 0.1 0.5 2 9 1 3 0.1 0.0 3 9 0 4 0.0 0.0 Inf 10 0
- TPR: true positive rate çé½æ§ç
- FPR: false positive rate å½é½æ§ç
- FN: false negative count å½é°æ§æ°
- FP: false positive count å½é½æ§æ°
AUC
wauc <- WeightedAUC(tp.fp) wauc
0.325
ãããã
if(require(ggplot2)){ gg <- ggplot()+ geom_path(aes(FPR, TPR), data=tp.fp)+ coord_equal() print(gg) }else{ plot(TPR~FPR, tp.fp, type="l") }