We have a website where users post video clips. We now want to sort the clips using Reddit's Hot Story Ranking algorithm.
Allow users to like and dislike clips. A user can only like or dislike once per clip but the user can go between like and dislike but the total count will never be greater than 1 or -1. (Same as Reddit)
Allow users to sort clips by Game/HOT. You can use [login to view URL] endpoint to cache/populate an auto complete or a dropdown menu. In the clip database there is a Game property on it that has the game name to match it against.
The clips returned should come back sorted by the game and if the user does not decide to sort by game the default clips returned should just be the HOT clips for all games.
HOT is an algorithm: Please Review the article heading: Digging into the story ranking code: [login to view URL]
Below the heading will be the definition of the HOT ranking algorithm
HOT Algorithm in Python:
from datetime import datetime, timedelta
from math import log
epoch = datetime(1970, 1, 1)
def epoch_seconds(date):
td = date - epoch
return [login to view URL] * 86400 + [login to view URL] + (float([login to view URL]) / 1000000)
def score(ups, downs):
return ups - downs
def hot(ups, downs, date):
s = score(ups, downs)
order = log(max(abs(s), 1), 10)
sign = 1 if s > 0 else -1 if s < 0 else 0
seconds = epoch_seconds(date) - 1134028003
return round(sign * order + seconds / 45000, 7)
Instead of ups vs downs, it would be likes and dislikes.
The Tech Stack: Node/Express, Mongodb, Handlebars, Materialize
hi,
I'm fullstack developer, i'm experience with nodeJS, mongoDB and so on.
In my fulltime job, i'm in a company which specialized in all sort optimization algorithm (path optimization).
it will be pretty easy for me to utilize HOT algorithm, and apply in your website.
please chat with me.