9
8 Comments

Repurposing Reddit's "Hot" ranking algorithm for my little Rails project

I created a site where people can vote and submit projects they want me to build.

It had 2 ranking modes, "top scoring" and "newest"

Issues with Top and New

This was fine when there was only a dozen projects, but as the list grew, two problems arose:

In the "top scoring view", the top few projects were monopolizing views and votes. Most people just weren't reading down the page enough to see the other ideas.

In the "newest" view, an idea only had a little time to be seen before it was buried by bad ideas or even spam. Also, spammy/bad ideas were invincible to downvotes by virtue of being new.

I needed a middle ground that would show the top ideas while also allowing new ideas a chance in the spotlight.

'Hot' to the rescue

I found reddit's Hot algorithm, translated it from Python to Ruby, and put it on the site.

It was kind of working, but it seems like it was weighing "recency" too much and not weighing the project's score enough. I think Reddit has such high voting volumes that my site's small vote counts was barely moving the needle for their algorithm.

I have no idea what I'm doing


I don't know much math beyond basic algebra. I was pretty mystified by this seemingly simple algorithm, but I got help from an engineer friend.

I found out that if I increased sign, I would amplify the effect of the score on the final ranking. And if I increased interval, I would decrease the importance of a project's recency.

I tweaked the values, eyed the effect, tweaked again, and eventually settled on a setting that resulted in a satisfying blend of the best projects from both "Top Ranked" and "Newest"

Hope this is useful/interesting :)

posted to Icon for group Developers
Developers
on February 18, 2021
  1. 1

    Have you found this algorithm effective in creating "meaningful rankings" (however you personally define them)?

    1. 1

      Actually, somewhat surprisingly, yes. It's definitely subjective, but the way it's managing to showcase promising newer ideas alongside the older high-rankers is just what I wanted.

      1. 1

        That makes sense about it being subjective. I think its super cool still. I think I might snag the algorithm for a future project of mine. You mind?

        1. 2

          I don't mind at all, that's why I shared it :)

          1. 1

            Cool, thanks buddy :)

  2. 1

    Also, here's the website in case you wanna see the sorting in action: oneweektomake.com

    1. 1

      I really like the design of the site :)

      1. 1

        Thank you dingran! Built in a rush over 2 days, so just decided to embrace the scrappy feel

Trending on Indie Hackers
Veo 3.1 vs Sora 2: AI Video Generation in 2025 🎬🤖 User Avatar 34 comments Your SaaS Isn’t Failing — Your Copy Is. User Avatar 33 comments Solo SaaS Founders Don’t Need More Hours....They Need This User Avatar 29 comments 🚀 Get Your Brand Featured on FaceSeek User Avatar 20 comments Planning to raise User Avatar 14 comments From side script → early users → real feedback (update on my SaaS journey) User Avatar 11 comments