mznmel / progmr

Progmr.com
11 stars 4 forks source link

A Ranking Algorithm #2

Open ahmads opened 11 years ago

ahmads commented 11 years ago

The current way of ordering the posts (by date or votes) has no way to surface the “hottest” posts; a raking algorithm would help solve that problem and greatly improve the user experience.

cenrak commented 11 years ago

There are a couple of ways that I could think of for this:

  1. Average upvotes per day, lets call it AUPD : This value equals to ((Total Number of Upvotes) / (The number of days since the post was published)). Posts with higher AUPD are shown first. There are two ways to calculate AUPD:
    1. On the fly. Once the main page is requested with AUPD, you will have to go through all posts in @posts and order them to AUPD, through calculating AUPD for each post, then sort them. <- Really bad O()
    2. Create a new AUPD column in the DB. The column is updated 1)daily for all posts, by a worker and 2)when a user upvotes a post, for that specific post.
  2. Average upvotes per view = ((Total Number of Upvotes)/(Total post views)). You can get the number of upvotes from post_votes and for the views, you can either have a counter to each post or a Visit model. Visit model would help in cases like number 4.
  3. Average views per day = ((Total views)/(Number of days since the post was published))
  4. You can change per day to per the last X days for 1 and 3. If you have a Visit mode, you can query the visits for the last month.

Lets be real. A hot post means that it's attracting lots of visitors. Moreover, it's getting lots of upvotes. So, I guess the second approach Average upvotes per view would be the one. Kaman, It would be even cooler if it's something like (Average upvotes per views) in the last week = ((Total Upvotes in the past week)/(Total views in the past week))

KrayemLy commented 11 years ago

you can build many different ways to order the posts daily or weekly or both & overall ordering

look at stackoverflow options http://stackoverflow.com/ they have usefully listing ways for the questions (( http://meta.stackoverflow.com/ ))

mznmel commented 11 years ago

Thanks all for the interesting discussion. I agree with you, a ranking algorithm would make the website much more useful.

I'm planing to implement an algorithm that's very similar to the one that's used by HackerNews. Here's the algorithm with a good discussion: http://news.ycombinator.com/item?id=1781013 It's most likely to be released with the next major version of Progmr, which's due sometime within the next week.