This function compares one (estimated) graph to another graph (true graph), returning a vector of 8 values:
the number of true positive edges ('TP') is the number of edges in the skeleton of 'egraph' which are also present in the skeleton of 'truegraph'
the number of false positive edges ('FP') is the number of edges in the skeleton of 'egraph' which are absent in the skeleton of 'truegraph'
the number of fralse negative edges ('FN') is the number of edges in the skeleton of 'truegraph' which are absent in the skeleton of 'egraph'
structural Hamming distance ('SHD') between 2 graphs is computed as TP+FP+the number of edges with an error in direction
TPR equals TP/(TP+FN)
FPR equals FP/(TN+FP) (TN stands for true negative edges)
FPRn equals FP/(TP+FN)
FDR equals FP/(TP+FP)
compareDAGs(egraph, truegraph, cpdag = FALSE, rnd = 2)
a named numeric vector 8 elements: SHD, number of true positive edges (TP), number of false positive edges (FP), number of false negative edges (FN), true positive rate (TPR), false positive rate (FPR), false positive rate normalized to the true number of edges (FPRn) and false discovery rate (FDR)
an object of class graphNEL
(package `graph'), representing the graph which should be compared to a ground truth graph or an ajecency matrix corresponding to the graph
an object of class graphNEL
(package `graph'), representing the ground truth graph or an ajecency matrix corresponding to this graph
logical, if TRUE (FALSE by default) both graphs are first converted to their respective equivalence class (CPDAG); this affects SHD calculation
integer, rounding integer indicating the number of decimal places (round) when computing TPR, FPR, FPRn and FDR
Asiascore<-scoreparameters("bde", Asia)
if (FALSE) {
eDAG<-learnBN(Asiascore,algorithm="order")
compareDAGs(eDAG$DAG,Asiamat)
}
Run the code above in your browser using DataLab