/ Published in: MySQL
URL: http://www.thebroth.com/blog/118/bayesian-rating
Use Bayesian values to get a "more fair" ranking than average value based ranking. Example with a "games" table having some ratings in table "ratings"
Expand |
Embed | Plain Text
# create a view with this query SELECT game_id, (SELECT count(game_id) FROM ratings) / (SELECT count(DISTINCT game_id) FROM ratings) AS avg_num_votes, (SELECT avg(rating) FROM ratings) AS avg_rating, count(game_id) as this_num_votes, avg(rating) as this_rating FROM ratings GROUP BY game_id # this query outputs the ranking values for each game SELECT game_id, ((avg_num_votes * avg_rating) + (this_num_votes * this_rating)) / (avg_num_votes + this_num_votes) as real_rating FROM `bayesian_rating_values2`
You need to login to post a comment.
