Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I'm trying to implement a review function on my website, but I want it weighed. I checked on IMDb and they have this:

weighted rating $(WR) = (v / (v+m)) R + (m / (v+m)) C$
$R$ = average for the movie (mean) = (Rating)
$v$ = number of votes for the movie = (votes)
$m$ = minimum votes required to be listed in the Top 50 (currently 1000)
$C$ = the mean vote across the whole report (currently 6.8)

Now, I was wondering how I would implement it for my situation. So please help me understand if what I assume here is correct:

$R$ = $\sum$(review of item $X$ * ratingvalue) / (total reviews of item $X$)

$v$ = total reviews of item $X$

$m$ = I have only a few reviews on my site right now, so does it matter what number I provide here? I thought I'd just enter 1

$C$ = which report do they mean by this? Do they mean the average value of a review across all reviews?

Example based on comments below (thanks guys):

Let's say I have two movies with the following ratings: Movie A votes: 8,8,10,5,7,8 Movie B votes: 10

Would that result in the following values for the variables: Movie A total reviews: 6 Movie B total reviews: 1

Movie A sum: 46 Movie B sum: 10

Movie A average: 7,666666667 Movie B average: 10

Thus for movie A the variable values would be: R 7,666666667 v 6 m 0,8 <- with value of variable m I could play based on whether this movie relatively has a lot of reviews C 8

And the rating would be: (WR)=(v/(v+m))R+(m/(v+m))C (WR)=(6/(6+0,8))7,666666667+(0,8/(6+0,8))8 (WR)=7,7

If that's correct: I also tried giving movie A 6*10 and movie B 1*10 but in that case it would make sense to rank movie A higher, which it doesn't with my current formula.

I also provided an example calculation sheet here to see if I'm doing it right: www.wunderwedding.com/files/reviewalgorithm.zip


share|improve this question
Think of it as if every item always has $m$ votes which are average. –  Thomas Andrews Jul 10 '12 at 13:01
add comment

2 Answers 2

The formula is just a weighted average of the "naive-individual" rating for this movie (item) and a (sort of) "a priori-noncommittal" rating. The idea is that, if you have very few votes for your particular movie, you don't put much trust on it, and lean instead toward a conservative estimate, the "a priori" noncommittal rating, e.g the average rating across your entire universe. When the number of votes for your particular movie gets large, you trust that individual rating more.

Once you grap the concept, you have quite freedom to prescribe your weights and the "a priori" rating. The important restrictions are: the weights must be in the $(0,1)$ range and sum up to one; the weight of the "a priori" rating should tend to $1$ if the movie has few votes, and to $0$ if it has many.

This is sometimes -losely- called "bayesian rating". See related: http://math.stackexchange.com/a/41513/312

share|improve this answer
add comment

You are correct, the variable $C$ is the average of all votes.

What this algorithm says is that every item is considered to have $m$ "phantom votes" all with value $C$.

The actual code is up to you, but you probably don't want to have to recalculate $C$ every time you compute a rating...

On error to avoid is computing $C$ as the average of the items' averages. That would be wrong. If IMDB had 8 votes averaging 9 for "Raiders of the Lost Ark" and 2 votes averaging 1 for "Big Momma's House," the average vote with be $\frac{9\times8+1\times2}{10}=7.4$, not $\frac{9+1}{2}=5$.

share|improve this answer
Sorry for the delay. Thanks for your reply, I updated my initial question, if you could have another look? –  Flo Sep 4 '12 at 13:31
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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