c# - Popularity decay algorithm for popular website posts -
i'm looking algorithm sort website results popularity.. reddit's older post less power it's votes/score has.
here accepted solution used reddit:
t = (time of entry post) - (dec 8, 2005) x = upvotes - downvotes y = {1 if x > 0, 0 if x = 0, -1 if x < 0) z = {1 if x < 1, otherwise x} rank = log(z) + (y * t)/45000
i've been on reddit's algorithm , although fit 1 situation, need 2 algorithms, 1 popular posts , upcoming posts:
- popular posts
- upcoming posts
popular decay slower, giving more weight older posts upcoming posts focus more on popular posts today, dropping off sharply after n hours/days/etc.
i'm writing using sphinx expressions can't write hugly complicated algo , have access following functions:
http://sphinxsearch.com/docs/current.html#numeric-functions
so have following data per post:
- post age in seconds
- post score
here current solution:
exponent = 0.01 (popular), 0.5 (upcoming) secondssincepublised = abs(curtimeinsecondssincedate-pubtimeinsecondssincedate) rank = (log10(postscore)*10000) / pow(secondssincepublised,exponent)
although solution work not ideal. new , popular post in last couple of hours ranks high in both popular , upcoming not want.
can suggest algorithm can modify exponent component adjust decay?
have tried ranking algorithm used hacker news? simple implement.
score = (p-1) / (t+2)^g where, p = points of item (and -1 negate submitters vote) t = time since submission (in hours) g = gravity, defaults 1.8 in news.arc
you can vary gravity adjust decay.
for more information refer how hacker news ranking algorithm works
Comments
Post a Comment