Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Jun 2006
    Location
    UK
    Posts
    922
    Thanks
    302
    Thanked 3 Times in 3 Posts

    Question Simple Rating Calculation

    Hi There,

    I am sure you have seen in many sites there are rating system. So, you can rate a product out of 5 or 10.

    Does someone knows the formula for displaying the rating result?

    Suppose, I have rated a product 3 out of 5 and the total number of votes is 1500 for that product. What will be the actual rating for that product?


    Thanks in advance

  • #2
    Regular Coder primefalcon's Avatar
    Join Date
    Aug 2008
    Location
    /home/primefalcon/
    Posts
    678
    Thanks
    8
    Thanked 39 Times in 39 Posts
    I suppose its an average score, there 2 ways to do it

    first way is

    keep a count of the total number votes cast, as you said 1500, now you assuming a voting mechanism between 1 and 5 for each persons vote add the number to the total voted score tallied thus far, say there's a total score of 6400 with max so far being 7505, with your vote and 7500 without your vote. you gave it a 3 however giving a total score of 6403, so divide that by 1501(votes cast) and that gives you an average of 4.265822785 which rounded gives you 4.3 or just an average of 4 if you round to a whole number.

    The other way is to keep a tally of every single vote, and add all the votes together and devide them by number of people voted.

    It kinda depends on how much info you want to store and how much processing you want to do. Process wise the first method is better.

  • #3
    Regular Coder
    Join Date
    Jun 2006
    Location
    UK
    Posts
    922
    Thanks
    302
    Thanked 3 Times in 3 Posts
    Quote Originally Posted by primefalcon View Post
    4.265822785
    4.265822785 ??


    How did you get that #?

    1501 / 5 = 300.2

    Kindly explain


    Thanks

  • #4
    Regular Coder primefalcon's Avatar
    Join Date
    Aug 2008
    Location
    /home/primefalcon/
    Posts
    678
    Thanks
    8
    Thanked 39 Times in 39 Posts
    Quote Originally Posted by cancer10 View Post
    4.265822785 ??


    How did you get that #?

    1501 / 5 = 300.2

    Kindly explain


    Thanks
    Sorry I meant divide the total tallied score by number of votes so 6403/1501.

    I've corrected that above, I actually had it right first, messed it up though when I was correcting typo's, sorry about that.

  • #5
    Regular Coder
    Join Date
    Jun 2006
    Location
    UK
    Posts
    922
    Thanks
    302
    Thanked 3 Times in 3 Posts
    Works!


    Thanks

  • #6
    Regular Coder primefalcon's Avatar
    Join Date
    Aug 2008
    Location
    /home/primefalcon/
    Posts
    678
    Thanks
    8
    Thanked 39 Times in 39 Posts
    Your welcome :-)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •