metrics

evaluation

class castle.metrics.evaluation.MetricsDAG(B_est, B_true)[source]

Bases: object

Compute various accuracy metrics for B_est. true positive(TP): an edge estimated with correct direction. true nagative(TN): an edge that is neither in estimated graph nor in true graph. false positive(FP): an edge that is in estimated graph but not in the true graph. false negative(FN): an edge that is not in estimated graph but in the true graph. reverse = an edge estimated with reversed direction.

fdr: (reverse + FP) / (TP + FP) tpr: TP/(TP + FN) fpr: (reverse + FP) / (TN + FP) shd: undirected extra + undirected missing + reverse nnz: TP + FP precision: TP/(TP + FP) recall: TP/(TP + FN) F1: 2*(recall*precision)/(recall+precision) gscore: max(0, (TP-FP))/(TP+FN), A score ranges from 0 to 1

Parameters

B_est: np.ndarray

[d, d] estimate, {0, 1, -1}, -1 is undirected edge in CPDAG.

B_true: np.ndarray

[d, d] ground truth graph, {0, 1}.