A Good Average Equation?

Hi, I want to make an Average rating system for my game which has builds made by other players. These builds are rated from 1-5.

I know I can just do TotalNumber / TotalRaters but there’s a problem with that.

Let’s say someone makes a build and two players rate it a 5. Now this build is probably going to strong textbe like top 10 rated builds because it’s going to be a 5/5.

But if someone made a build where one player rated it a 5, and another rated it a 1, it would be 3 and it would ruin the whole rating.

I want an equation/algorithm to be able to make an accurate average without making it too sensitive to low TotalRaters.

1 Like

So the truth is, if you’re trying to skew averages, it will never be accurate, that’s just the way it is. Any algorithm or equation will inherently add in some amount of inaccuracy to what the players are actually rating the builds as.

With that being said, you could achieve something close to what you want, in a simple way, by setting a “default rating”

We’ll say, start each build with 10 ratings and they’re all 3/5 ratings, now whenever someone goes to rate it, their rating will be less impactful until more and more people start to show up and rate that build, thus pushing it towards what the players think the actual rating should be.

To prevent this from having a lasting impact on players ratings, you could remove those default ratings when they get up to a certain amount of ratings on their build, say for every 10 real ratings they get, remove 1 of the default ratings, removing them 1 at a time ensures that the rating won’t noticeably jump.

As for how this would look in your code, calculating the new rating would be almost as simple as your original calculation:
(TotalNumber + DefaultNumber) / (TotalRaters + DefaultRates)

Of course, this, like any solution to a problem of low sample size averages, has it’s own share of issues, if you have 10 default rates, and 1 person comes up and sees a terrible build and rates it a 1, then it would make very little difference until more people come up and rate it.

1 Like

I see what you’re saying. One thing though, I don’t really understand what you meant with the default stuff. Can you explain a little more if that’s okay?

he talking about this thing: Bayesian Average


It’s kinda difficult to break this down further, but I’ll do my best!

So, when we create a new build, we’ll assign it a starting amount of ratings, for this example I’ll stick to 10 ratings, and each rating will have a value of 3. So, 30 is the rating to start a new build with, and the average of that would be 3/5, so a brand new build would have a starting rating of 3/5.

As players come through and rate it, their ratings would be less impactful at first because those first 10 starting ratings are still in effect, as more people rate it though, the rating that the people actually think the build deserves will come through.

After a certain amount of human ratings have been given you would then likely want to remove the starting ratings so that they do not have a lasting impact, so you’d want to store the starting ratings separately from the rest of the real ratings.

--Something like this:
local AdjustedStartingRates = math.clamp(10 - (math.floor(TrueRatings/5), 0, 10) -- for every 5 real ratings, we'll remove one of our starting ones
local AdjustedRating = (TotalNumber + (AdjustedStartingRates * 3)) / (TotalRaters + AdjustedStartingRates)
1 Like

There is no way to get a more accurate rating for few raters. A lot of sites that have a “sort by highest rated” feature simply require an entry to have some minimum number of ratings to be eligible for appearing in the sorted list.

Another popular option is to quantize average ratings into discrete bins, e.g. all builds with an average above 4.5 would be in the top bin, shown as having a rating of 5 stars. Averages above 4.0 but at or below 4.5 get shown as 4.5 stars, etc. All user-facing ratings are rounded to the nearest whole number or 0.5 increment. Then, within each discrete star rating bin, those with more votes sort higher. A build with a 4.7 average from 200 raters will sort above a build with 5.0 average from just 3 ratings. The confidence in the average goes up with number of raters, so it’s totally fine to sort the 5.0 build lower since it’s rating is highly uncertain. Even with this type of system, a minimum number of votes is usually still a good idea.

1 Like

Thanks for the reply. I get it so much more now!

Also I have another question that involves another game I’m working on which involves a similar equation, but is pretty much the same as IMDb does it.

Basically IMDb has users rate a movie by 1-10 and the users can upvote or downvote these ratings. This upvoting thing basically affects how much the review affects the average. How would I make an equation for something like this? A lot of things come into play here so it really makes me wonder