View source: R/measures_pairs.R
eval_report_pairs | R Documentation |
Compute various evaluation measures for a set of predicted coreferent (linked) pairs given a set of ground truth coreferent pairs.
eval_report_pairs(true_pairs, pred_pairs, num_pairs = NULL, ordered = FALSE)
true_pairs |
set of true coreferent pairs stored in a matrix or data.frame, where rows index pairs and columns index the ids of the constituents. Any pairs not included are assumed to be non-coreferent. Duplicate pairs (including equivalent pairs with reversed ids) are automatically removed. |
pred_pairs |
set of predicted coreferent pairs, following the same
specification as |
num_pairs |
the total number of coreferent and non-coreferent pairs,
excluding equivalent pairs with reversed ids. If not provided,
measures that depend on the number of true negatives will be returned
as |
ordered |
whether to treat the element pairs as ordered—i.e. whether
pair |
Returns a list containing the following measures:
see precision_pairs
see recall_pairs
see specificity_pairs
see sensitivity_pairs
see f_measure_pairs
see accuracy_pairs
see balanced_accuracy_pairs
see fowlkes_mallows_pairs
The contingency_table_pairs
function can be used to compute
the contingency table for entity resolution or record linkage problems.
### Example where pairs/edges are undirected
# ground truth is 3-clique
true_pairs <- rbind(c(1,2), c(2,3), c(1,3))
# prediction misses one edge
pred_pairs <- rbind(c(1,2), c(2,3))
# total number of pairs assuming 3 elements
num_pairs <- 3 * (3 - 1) / 2
eval_report_pairs(true_pairs, pred_pairs, num_pairs)
### Example where pairs/edges are directed
# ground truth is a 3-star
true_pairs <- rbind(c(2,1), c(3,1), c(4,1))
# prediction gets direction of one edge incorrect
pred_pairs <- rbind(c(2,1), c(3,1), c(1,4))
# total number of pairs assuming 4 elements
num_pairs <- 4 * 4
eval_report_pairs(true_pairs, pred_pairs, num_pairs, ordered = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.