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
object from the ROCR package. This facilitates evaluation of structure
learning with traditional machine learning metrics such as ROC curves and AUC.
an object of class
an object of class
additional arguments, currently ignored.
a boolean value. If
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
boot.strength() as the predictions.
An object of class
prediction from the ROCR package.
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)
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":  "None" Slot "y.name":  "Area under the ROC curve" Slot "alpha.name":  "none" Slot "x.values": list() Slot "y.values": []  0.8427164 Slot "alpha.values": list()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.