rocrpkg: Generating a prediction object for ROCR

Description Usage Arguments Details Value Author(s) Examples

Description

Evaluate structure learning accuracy with ROCR. This function views the arcs in a bn.strength object as a set of predictions and the arcs in a true reference graph as a set of labels, and produces a prediction object from the ROCR package. This facilitates evaluation of structure learning with traditional machine learning metrics such as ROC curves and AUC.

Usage

1
2
## S3 method for class 'bn.strength'
as.prediction(x, true, ..., consider.direction = TRUE)

Arguments

x

an object of class bn.strength returned by boot.strength(), representing learning results targeting the object of class bn specified by the true argument.

true

an object of class bn, the target of structure learning.

...

additional arguments, currently ignored.

consider.direction

a boolean value. If TRUE an arc's prediction value is set to the product of its strength and direction values in x (interpreted as the probability an arc is both present and has the specified direction). If FALSE the arc's prediction value is set to its strength value.

Details

One way of evaluating the overall performance of a network structure learning algorithm is to evaluate how well it detects individual arcs. as.prediction() takes each pair of nodes in a ground truth network and labels them with a 1 if an arc exists between them and 0 if not. It uses the arc presence probabilities in a bn.strength object returned by boot.strength() as the predictions.

Value

An object of class prediction from the ROCR package.

Author(s)

Robert Ness

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 
library(ROCR)

modelstring = paste0("[HIST|LVF][CVP|LVV][PCWP|LVV][HYP][LVV|HYP:LVF][LVF]",
  "[STKV|HYP:LVF][ERLO][HRBP|ERLO:HR][HREK|ERCA:HR][ERCA][HRSA|ERCA:HR][ANES]",
  "[APL][TPR|APL][ECO2|ACO2:VLNG][KINK][MINV|INT:VLNG][FIO2][PVS|FIO2:VALV]",
  "[SAO2|PVS:SHNT][PAP|PMB][PMB][SHNT|INT:PMB][INT][PRSS|INT:KINK:VTUB][DISC]",
  "[MVS][VMCH|MVS][VTUB|DISC:VMCH][VLNG|INT:KINK:VTUB][VALV|INT:VLNG][ACO2|VALV]",
  "[CCHL|ACO2:ANES:SAO2:TPR][HR|CCHL][CO|HR:STKV][BP|CO:TPR]")
true.dag = model2network(modelstring)
strength = boot.strength(alarm, R = 200, m = 30, algorithm = "hc")
pred = as.prediction(strength, true.dag)
perf = performance(pred, "tpr", "fpr")
plot(perf, main = "Arc Detection")
performance(pred, "auc")

## End(Not run)

Example output

Attaching package: 'bnlearn'

The following object is masked from 'package:stats':

    sigma

Loading required package: gplots

Attaching package: 'gplots'

The following object is masked from 'package:stats':

    lowess

There were 50 or more warnings (use warnings() to see the first 50)
An object of class "performance"
Slot "x.name":
[1] "None"

Slot "y.name":
[1] "Area under the ROC curve"

Slot "alpha.name":
[1] "none"

Slot "x.values":
list()

Slot "y.values":
[[1]]
[1] 0.8427164


Slot "alpha.values":
list()

bnlearn documentation built on Sept. 7, 2021, 1:07 a.m.