On Tue, 02 Jul 2013 23:43:51 +0200, Surya Kasturi wrote: > Hi all, this seems to be quite stupid question but I am "confused".. We > set the initial value to 0, +1 for up-vote and -1 for down-vote! nice. > > I have a list of bool values True, False (True for up vote, False for > down-vote).. submitted by users. > > [True, False, False, True....] > > Now to calculate the total reputation > > should I take True = +1, False=0 [or] True = +1, False=-1 ?? for adding > all.
You can work this out for yourself by doing a couple of tests. Suppose you have somebody who gets one Upvote and five Downvotes: [True, False, False, False, False, False] What reputation would you expect them to have? We can't answer that, only you can answer that. With True=+1 and False=0, the sum is +1. With True=+1 and False=-1, the sum is -4. Upvotes and downvotes don't have to be weighted the same: With True=+5 and False=-1, the sum is 0. With True=+1 and False=-5, the sum is -24. *You* have to decide how you want the reputation system to work, then program it to work that way. For a real web app, you almost certainly do not want something this simple. Perhaps new accounts with low reputation themselves should be weighted less than old, established accounts with high reputation. There is no standard for counting reputation, and so every web site that does something like this does it differently, and most get it wrong, including some really big, well-known sites like Amazon. It's very easy to come up with lousy algorithms for calculating reputation, much harder to come up with good algorithms. I second Joshua Landau's recommendation that you read: http://www.evanmiller.org/how-not-to-sort-by-average-rating.html and I bring to your attention that this doesn't necessarily have anything to do with *sorting*. The Ruby function given returns a number between 0 and 1. You don't have to sort on that number, you can use that as your reputation. -- Steven -- http://mail.python.org/mailman/listinfo/python-list