Last time, I introduced the hacker News ranking algorithm. It is characterized by the user can only vote in favour of the vote, but many sites also allow users to vote against. In other words, in addition to praise, you can also give an article for a bad comment.
Reddit is the largest online community in the United States, where each post has an up and down arrow, which expresses "aye" and "objection" respectively. The user clicks to vote, Reddit calculates the newest "hot article List" according to the result of the vote.
How can we combine the pro and negative votes to figure out the most popular articles for some time? If article A has 100 votes in favour, 5 votes against, article B has 1000 votes in favour of, 950 votes against, who should be in front of the list?
The Reddit program is open source and is written in Python language. The code for the ranking algorithm is roughly as follows:
This code takes into account a number of factors such as:
(1) Post's new and old degree T
t = Posting time-December 8, 2005 7:46:43
The unit of T is a second, calculated with a Unix timestamp. It is not difficult to see that once the post is published, T is fixed value, will not change with time, and the new posts, T value larger. As for December 8, 2005, it should be the time when Reddit was established.
(2) The difference between the vote and the negative X
x = Pro Vote-Negative