Compute the distance between two rankings according to several metrics.
get_rank_distance(r1, r2, metric)
A scalar.
A vector of ranks.
A vector of ranks.
A string. Available options are "footrule"
,
"kendall"
, "cayley"
, "hamming"
, "spearman"
, and "ulam"
.
Note that the Spearman distance is the squared L2 norm, whereas the footrule distance is the L1 norm.
The Ulam distance uses the SUBSET library developed by John Burkardt, available at http://people.sc.fsu.edu/~jburkardt/cpp_src/subset/subset.html.
The implementation of Cayley distance is based on a C++
translation of Rankcluster::distCayley
Grimonprez2016BayesMallows.