Search code examples
algorithmmathvotingweighted-average

Adjusting votes based on different numbers of voters


I have a 1 to 5 voting system and i'm trying to figure out the best way to find the most popular item voted on, taking into consideration the total possible number of votes cast. To get a vote total, i'm counting "1" votes as -3, "2" votes as -2, "3" votes as +1, "4" votes as +2, "5" votes as +3, so a "1" vote would cancel out a "5" vote and vice versa.

For this example, say we have 3 films playing in 3 different size theaters.

Film 1: 800 seats / Film 2: 400 seats / Film 3: 180 seats

In a way, we're limiting the total amount of votes based on seats, so I would like a way for the film in the smaller theater to not get automatically overwhelmed by the film in the larger theater. It's likely that there will be more votes cast in the larger theater, resulting in a higher total score.


Edit 10/18:

Alright, hopefully I can explain this better. I'm working for a film festival, and we're balloting the first screening of each film in the fest. Therefore, each film will have from 0 to a maximum number of votes based on the size of each theater. I'm looking to find the most popular film in 3 categories: narrative, documentary, short film. By popular I mean a combination of highest average vote and number of votes.

It seems like a weighted average is what i'm looking for, giving less weight to votes from a bigger theater and more weight to votes from a smaller theater to even things out.


Solution

  • You're working with weighted averages.

    Instead of just adding up and dividing by the total number of elements (arithmetic mean):

     a + b + c
     ---------
         3
    

    You are adding weights to each element, as they are not all evenly distributed:

     w1*a + w2*b + w3*c
     ------------------
             3
    

    In your case, the weights could be this:

    # of people in current theater
    --------------------------------
    # of people in all the theaters
    

    Let's try a test case:

    Theater 1: 100 people       (rating: 1)
    Theater 2: 1,000,000 people (rating: 5)
    
    Average = (100 / (100 + 1000000)) * 1 + (1000000/(100 + 1000000)) * 5
              -----------------------------------------------------------
                                          2
            = 2.49980002