algorithm used to calculate 5 star ratings

前端 未结 14 901
挽巷
挽巷 2021-01-29 17:49

I need to calculate 5-star ratings like the one on Amazon website. I have done enough search to find what is the best algorithm, but I am not able to get a proper answer. For ex

14条回答
  •  野的像风
    2021-01-29 18:35

    This rating system is based on a weighted average or weighted mean. That is, they used the weight in terms of stars to compute a decimal value which rounds to 4.1. For example:

    Sum of (weight * number of reviews at that weight) / total number of reviews
    (5*252 + 4*124 + 3*40 + 2*29 + 1*33) / 478 = 4.1
    

提交回复
热议问题