Mike
Mike

Reputation: 1312

rank correlation algorithm

I have a ranking list of friends. Then, I get few more lists of the same friends but different ranking. Is there an algorithm to check which list is the closest to the original ranking list?

Thanks

Upvotes: 1

Views: 223

Answers (2)

artahian
artahian

Reputation: 2093

I think you should compare rank distances between them, but using weights. Because for example if user ranked 1st is on 10th place, it is a big difference, but if user ranked 101th is on 110th place, that's not a big change. So you should put higher coefficients on differences of higher ranked users.

Upvotes: 2

abeln
abeln

Reputation: 3759

It likely depends on what your measure of "distance" between two rankings is.

For example, if we define

dist(R1, R2) = Sum abs(position of i in R1 - position of i in R2), over all i

then you can store the positions of every i in the first ranking in an array

i.e.

pos[Peter] = 3

means that Peter shows up as the third friend in your ranking.

The closest ranking can be found in linear time by calculating the sum above using pos.

Upvotes: 2

Related Questions