

Request: simple story promotion algorithm - zemaj

Hi all,<p>I recently added a karma-like voting system to posts in a phpBB forum that was having some problems with spam (we have an point incentive system that users use to bid for real items - now instead of rewarding points for posts, they're now awarded for votes).<p>My question is; does anyone know a simple algorithm that can get a list of the "best-recent" posts based on votes. So simply if an item has a certain number of positive and negative points with each vote point made at a certain time, how can I combine that to get a list of highly voted, recent posts.<p>I could obviously research and come up with something myself, but there's probably quite a few people here who have experience in this area, so I thought it was worth a post!<p>Thanks,
James
======
dfranke
PG recently posted the algorithm that news.yc uses:

<http://news.ycombinator.com/item?id=38704>

------
niels
I use an algorithm where recent votes and posts has more weight:

(votes from the last two hours times 1) + (votes from the next two hours times
0.75)... and so on. Do the same for posts. Because it's expensive to calulate
these values, I have a cron job that updates the scores every fifteen minutes.

~~~
zemaj
Sounds perfect - thanks.

Presumably after several hours you could discount the votes altogether since
they would have such a little influence on the final result. That would stop
the system getting bogged down over time.

Out of interest, what is your "and so on". Do you go to 0.5 for the next 2
hours?

~~~
niels
Yes, the so on means go to 0.5 for the next 2 hours. Of course you have to
tweak the parameters to get the desired results for your site. It how all
depends on how much you value recent posts and votes, versus overall votes. I
also subtract a value depending on how old the post is. The site I use this
for doesn't have any users, but it seems to work well in my limited testing.

------
nreece
Rank = ( ( current_time - post_time ) / number_of_votes )

Simple enough!

~~~
dfranke
That would make everything start out at #1.

~~~
zemaj
Presumably the "best" post would be the one with the lowest rank.

~~~
dfranke
Yes. By the above formula, everything would have a rank of zero when it was
first posted.

~~~
zemaj
If you exclude everything with 0 votes, since you can't divide by 0 anyway, it
might work.

