Accurate star rating calculation

1k views Asked by At

I need to calculate a star rating for a product I know how to calculate the weighted average, but its not good enough

example (5*252 + 4*124 + 3*40 + 2*29 + 1*33) / (252+124+40+29+33) = 4.11

I want to avoid cases when a product get a 1000 five star ratings and one 4 star, and another one gets just one 5 stars and it gets on top

I know there is a way but i couldn't find it

thanks

3

There are 3 answers

0
Zainul Abdin On

Try sort you product record using new column (rating * votes).

it will help you to find the most voted product with best rating.

0
Jekyll On

You can multiply for a weight function, that gives a penalty to product with lower number of votes and converge in time. Something like this should do the job. enter image description here

a parabole truncated to 1 should do the job

EX:

convergence_step=1000
if voters<convergence_step:
   meanscore=score*{[(voters)/(float)(convergence_step)]^2}
else
  meanscore=score
0
dev On

use sorting which can include number of ratings, something like number of votes divided by calculated avg rating.