AUC: Threshold independent performance measures for probabilistic classifiers.

> library(AUC)
AUC 0.3.0
Type AUCNews() to see the change log and ?AUC to get an overview.
> data("churn")

バージョン: 0.3.0


関数名 概略
AUC-package Threshold independent performance measures for probabilistic classifiers.
AUCNews Display the NEWS file
accuracy Compute the accuracy curve.
auc Compute the area under the curve of a given performance measure.
churn Churn data
plot.AUC Plot the sensitivity, specificity, accuracy and roc curves.
roc Compute the receiver operating characteristic (ROC) curve.
sensitivity Compute the sensitivity curve.
specificity Compute the specificity curve.

auc

AUC曲線による面積(値)の計算。同じくAUCの算出にはMESS::aucもある。

Arguments

  • x
  • min... 0から1の範囲の値(既定値 0)
  • max... 0から1の範囲の値(既定値 1)
> sensitivity(churn$predictions, churn$labels) %>% auc()
[1] 0.8026259
> specificity(churn$predictions, churn$labels) %>% auc()
[1] 0.4591936
> accuracy(churn$predictions, churn$labels) %>% auc()
[1] 0.5034279
> roc(churn$predictions, churn$labels) %>% auc()
[1] 0.8439201

churn

3つの変量からなるデータセット

> data("churn")
> dplyr::glimpse(churn)
Observations: 1302
Variables:
$ predictions  (dbl) 0.000, 0.000, 0.000, 0.216, 0.000, 0.298, 0.326, ...
$ predictions2 (dbl) 0.000, 0.002, 0.010, 0.096, 0.000, 0.232, 0.262, ...
$ labels       (fctr) 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, ...

roc

ROC(受信者操作特性)曲線による面積(値)の計算

> roc(churn$predictions, churn$labels) %>% str()
List of 3
 $ cutoffs: num [1:220] 1 1 0.972 0.968 0.964 0.96 0.932 0.91 0.908 0.902 ...
 $ fpr    : num [1:220] 0 0.00262 0.0035 0.0035 0.0035 ...
 $ tpr    : num [1:220] 0 0.164 0.164 0.182 0.189 ...
 - attr(*, "class")= chr [1:2] "AUC" "roc"