View source: R/measures_pairs.R
fowlkes_mallows_pairs | R Documentation |
Computes the Fowlkes-Mallows index for a set of predicted coreferent (linked) pairs given a set of ground truth coreferent pairs.
fowlkes_mallows_pairs(true_pairs, pred_pairs, 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 |
ordered |
whether to treat the element pairs as ordered—i.e. whether
pair |
The Fowlkes-Mallows index is defined as the geometric mean of
precision P
and recall R
:
\sqrt{P R}.
Fowlkes, E. B. and Mallows, C. L. "A Method for Comparing Two Hierarchical Clusterings." Journal of the American Statistical Association 78:383, 553-569, (1983). \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1080/01621459.1983.10478008")}.
true_pairs <- rbind(c(1,2), c(2,3), c(1,3)) # ground truth is 3-clique
pred_pairs <- rbind(c(1,2), c(2,3)) # prediction misses one edge
num_pairs <- 3 # assuming 3 elements
fowlkes_mallows_pairs(true_pairs, pred_pairs, num_pairs)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.