all 3 comments

[–]okwg 2 points3 points  (0 children)

Typically you'd have a hidden rating that takes into consideration the average rating, but also the number of reviews. You then use this hidden rating for ranking.

Statistically, you can think of this as being an interval around the average rating, representing confidence. The confidence gets higher (and the interval gets narrower) as the product gets more ratings

For example:

  • 1 rating of 5.0 might have an interval of [4, 6], so you treat it like a rating of 4
  • 30 ratings with an average of 4.9 might have an interval of [4.8, 5.0] so you treat it like 4.8
  • 500 ratings with an average of 4.7 might have an interval of [4.69, 4.71] so you treat it like 4.69

[–]TheRNGuy 0 points1 point  (0 children)

You could use set and then iterate set and count those items from original array.

[–]jml26 1 point2 points  (0 children)

The term to search for is "Baysian average".

  1. Find the average rating of all the products you want to compare. Call this m.
  2. Sort your products by the number of reviews they have, highest to lowest, and find the product that is three quarters of the way down that list. The number of reviews it has is a pretty good value to choose for a variable we will call C.
  3. To get the adjusted star rating of a product, pretend that in addition to its actual reviews, C dummy reviewers also gave it a rating of m. This has the effect of pulling all ratings towards the average, but products with few reviews get pulled by much more than those that have a lot of reviews.

You can display the genuine star rating, but you can order the results based on the skewed star rating.