2
$\begingroup$

I have a data set that's a dictionary of tuples. Each key represents an ID number and each tuple is (yesvotes, totalvotes). Example:

{17: (6, 10), 18: (1, 1), 21: (0, 2), 26: (1, 1), 27: (3, 4), 13: (2, 2)}

I need to find the max key of the set. I want to assign weights so, for instance, key 17 would be ranked higher than key 18 because even though the ratio is much smaller, it has ten times the total votes.

Is there an optimal way to do this? My best guess is simply calculate new ratios by (yesvotes/totalvotes)*(totalvotes+1) but that doesn't seem right... Is there some kind of standardized field of study concerning fair-voting?

$\endgroup$
3
$\begingroup$

Yes, this is a well-studied problem: rank aggregation. Here is a solution with code.

The problem is that the quantity you are trying to estimate, the "score" of the item, is subject to noise. The fewer votes you have the greater the noise. Therefore you want to consider the variance of your estimates when ranking them.

$\endgroup$
  • $\begingroup$ Ah, rank-aggregation. I knew there was a term for it $\endgroup$ – Austin Capobianco Feb 20 '16 at 1:01
2
$\begingroup$

Have a look at the example on "How to order Reddit comments" using their up- & down-votes in Cam Davidson Pilon's book.

$$ \frac{a}{a+b} - 1.65\sqrt{\frac{a b}{(a+b)^2(a+b+1)}} $$ where $$ a = 1 + u $$ $$ b = 1 + d $$

$u$ is the number of yes votes and $d$ is the number of no votes.

Sorting your data using the score obtained from that formula results in the following table (highest score first):

id  total  yes  no     score
13      2    2   0  0.430479
27      4    3   1  0.372679
17     10    6   4  0.357720
18      1    1   0  0.277758
26      1    1   0  0.277758
21      2    0   2 -0.069521
$\endgroup$
  • $\begingroup$ That's def interesting but it doesn't give me the rank order I'm seeking. $\endgroup$ – Austin Capobianco Feb 20 '16 at 1:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.