Compute the distance between two rank vectors.
get_rank_distance(r1, r2, metric)
A vector of ranks.
A vector of ranks.
A string. Available options are "footrule"
,
"kendall"
, "cayley"
, "hamming"
, "spearman"
, and "ulam"
.
Defaults to "footrule"
.
A scalar.
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.