Note that there are some explanatory texts on larger screens.

plurals
  1. POWeighted Mean
    text
    copied!<p>I have an existing web app that allows users to "rate" items based on their difficulty. (0 through 15). Currently, I'm simply taking the average of each user's opinion and presenting the average straight from MySQL. However, it's becoming clear to me (and my users) that weighting the numbers would be more appropriate.</p> <p>Oddly enough, a few hours of Google-ing hasn't turned up much. I did find two articles that showed site-wide ratings systems based off of "Bayesian filters" (which I partially understand). <a href="http://v3.siteframe.org/document.php?id=595" rel="nofollow noreferrer">Here</a>'s one example:</p> <blockquote> <p>The formula is:</p> <p>WR=(V/(V+M)) * R + (M/(V+M)) * C</p> <p>Where:</p> <pre><code>* WR=Weighted Rating (The new rating) * R=Average Rating (arithmetic mean) so far * V=Number of ratings given * M=Minimum number of ratings needed * C=Arithmetic mean rating across the whole site </code></pre> </blockquote> <p>I like the idea here of ramping up the weighting based on the total number of votes per item...however, because the difficulty levels on my site can range drastically from item to item, taking "C" (arithmetic mean rating across the whole site) is not valid. </p> <p>so, a restate of my question:</p> <p>Using MySQL, PHP, or both, I'm try to get from aritmetic mean:</p> <pre><code>(5 + 5 + 4)/3 = 4.67 (rounded) </code></pre> <p>...to a weighted mean:</p> <pre><code>rating / weight 5 / 2 (since it was given 2 times) 5 / 2 4 / 1 (sum[(rate * weight)])/(sum of weights) (5 * 2) + (5 * 2) + (4 * 1) / (2 + 2 + 1) (24)/(5) = 4.8 </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload