Make the trending algorithm tunable and add number of comments to inputs #472
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The purpose of this PR is two-fold:
likes_count
*comments_count
;.env
vars and then tuning the algo is as simple as modifying the env file and re-caching the config. This is just a quick, simple way to accomplish this and a method I've used in the past. One could also do this via a cache/database lookup, but I wanted to throw this together in literal minutes.Algo FYI:
likes_bias
andcomments_bias
allows you to alter the relative weighting of those two inputs.time_bias
is important for the "tuning." It basically specifies how time-sensitive you want the algo to be. A smaller number will favor recent posts. I made the default equal to one day's worth of seconds. Just kind of seemed like a good starting place based on my locally seeded data and some Excel calculations. Ideally, we would make this number roughly equal to the number of seconds it takes for the avg post to reach it's maximum trending-input (likes * comments) amount.vs (1 hour)
or (3 days)