1
$\begingroup$

I need a rating system for my app, what happens is that a user can rate a thread 1 to 5. The calculation I was going to use was shown below.

$$\begin{array}{llll} \text{ID}&\text{UID}&\text{TID}&\text{Rating}\\ \hline 1&1&37&5\\ 2&4&37&5\\ 3&8&37&5\\ 4&22&37&5\\ 5&2&37&5\\ \end{array}$$

This is a sample table, as you can see the way I did it was:

$$r_1\qquad\quad r_2\qquad\quad r_3\qquad\quad r_4\qquad\quad r_5\quad\\ \frac{(0\times1)+(0\times2)+(0\times3)+(0\times4)+(0\times5)}5=5$$

There is no user (UID) with a rating of $1$ ($r_1$) so you set $r_1 = (0 \times 1)$ but there are users (UID) with a rating of $5$ ($r_5$) so you set $r_5 = (5 \times 5)$ and the rest $r_2, r_3, r_4$ are set to $0$ as there are no ratings for those.

I get a rating of 5 stars.

But my problem is if 100 different users all rate the thread 5 you will get a rating of 5 using the formula given, also if 5 different users rated another thread 5 you would get a rating of 5 also. But I don't want these results as both ratings for each thread will hit the top. I know I could select in SQL to order the threads by number of users who have rated the thread so the 100 different users will go top this works, but the threads that had 5 users who rated 5 will be second.

Is there another way to rate theses threads taking into account how many users have rated each thread?

$\endgroup$

1 Answer 1

1
$\begingroup$

Yes, there are many ways to incorporate the number of users in your rating scheme. For example, suppose N is the number of raters you think a thread should have and A is the number of raters the thread actually has. Then multiply the average rating by max(1,A/N).

$\endgroup$
5
  • $\begingroup$ your may be right, but this question was asked in the programming section of stack exchange, i have not a good understanding of what you have suggested, but if you could get more specific with a formula and i will then try and understand it. Thanks though for your answer. $\endgroup$
    – redoc01
    Jun 27, 2015 at 13:58
  • $\begingroup$ 1. Choose a number of users that you want to rate each thread. I'll pick 10 for this illustration. 2. Calculate the average rating as you have done in your question. Call that number R. 3. Count the number of ratings. Call that A. 4. Calculate $RA/10$. 5. If $RA/10 \leq 5$, then $RA/10$ is the final score. If $RA/10 >5$, then 5 is the final score. $\endgroup$ Jun 27, 2015 at 14:09
  • $\begingroup$ ok we say C = RA/N. N is the number of raters which in my example is 5 so N = 5, R = 5 using my formula and A = 5 so the resulting rating C = (5x5)/5 so C = 5. This is correct. OK now what about this I have raters of 100 so N = 100, R = (100 x 5 / 100) using my formula R = 5 and i have C = 5A/100. So A = 100 raters, this then is (5x100)/100 which = 5. this is correct but as you can see that i need to take into account the number of raters. I cannot have 5 raters that rated 5 and 100 raters that rated 5 this would result in both reaching the top. This is my original question. $\endgroup$
    – redoc01
    Jun 27, 2015 at 14:32
  • $\begingroup$ Pick one value for N and stick with it for all future calculations. So, let's say you decide that a thread should have 100 raters, so N =100. Your example thread with 5 raters would get a score of 5x5/100 = 0.25 and the thread with 100 raters would get a score of 5x100/100 = 5. $\endgroup$ Jun 27, 2015 at 14:36
  • $\begingroup$ Thanks Doug, appreciate your help. $\endgroup$
    – redoc01
    Jun 27, 2015 at 14:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .