1

Building a feature of top of existing site w/ articles and videos (posts) that allows people to see what is popular on the site. I have the following fields for each post:

  • Number of seconds since post was published
  • Number of comments made on post
  • Number of "likes" on posts

I want to bake a simple algorithm to determine what is popular but need to factor in decay (from time being elapsed).

phirschybar
  • 8,357
  • 12
  • 50
  • 66
  • just playing with my own. like variations of: (n_likes * 2) + (n_comments * 4) / (n_seconds / (60 * 60 * 24)) I think I am missing some of the magic of established trending algorithms. – phirschybar Nov 01 '11 at 15:54
  • There is no magic. You just need to clearly define your specification. When you have clearly identified the bounds and effect of decay, the code will be easy to write. – George Cummins Nov 01 '11 at 15:57
  • a Google search for [popularity algorithm with decay] brings up lots of good results. Also see the related questions about trending topics algorithms such as http://stackoverflow.com/questions/143781/what-is-search-twitter-coms-trending-topics-algorithm – Jim Mischel Nov 01 '11 at 16:16
  • Usually things like `e^(- a t + b * comments + c * likes)` work pretty well. You should choose {a,b,c} to fit your preferences – Dr. belisarius Nov 02 '11 at 05:12
  • This was most helpful: http://stackoverflow.com/questions/143781/what-is-search-twitter-coms-trending-topics-algorithm – phirschybar Nov 17 '11 at 12:42
  • You should also probably have a the number of seconds since the last post. For example if the post was made a long time ago but there is still a steady stream of comments on it, you probably want that to show up higher than a post that was made a long time ago and was very popular (got a lot of comments) but only for a day or two after it was made. – hackartist Dec 12 '11 at 22:24

0 Answers0