Where do mathematical algorithms for Reddit's ranking, as an example, come from?
Asked Answered
T

2

5

recently I was looking at Reddit's algorithm for determining what makes a post a "hot" topic and which content is suitable for the reddit homepage.

the article I was reading is here: http://amix.dk/blog/post/19588

I've noticed they have mathematical logorithms and have created some kind of a mathematical function to determine the hotness/relevance of a post.

In the formulas used, where do each of the mathematical components come from and how do they know to use them?

thank you!

-- Bakz

EDIT: just to clarify, I just graduated high school and apologize if the answer to this question seems pretty obvious. thanks again!

Throng answered 3/7, 2011 at 22:45 Comment(4)
It looks like the link you posted goes into a fair amount of detail. Is there a specific formula that's confusing to you? Also, you could consider asking this on math.stackexchange.com as well.Enenstein
It seems you've already discovered the algorithm; you want to know where it comes from? Find a problem; and a solution. Not so different from a programming skill. Randall Munroe has a good article on how Reddit sorts its comments: blog.reddit.com/2009/10/reddits-new-comment-sorting-system.htmlShellishellie
specifically, amix.dk/uploads/reddit_cf_algorithm.png the last formula in that image would do.Throng
"How do they know to use them?" -- People understand maths well and apply it to situations, algorithm creation is a primary skill in mathematics as in programming. It's like saying how does a chef know what ingredients to use, or how does a doctor know what is wrong with you.Inwards
H
22

I'll tackle the first formula, for "hotness" of posts. Formulas like this come from requirements. The designers of Reddit have thought about what they want to achieve, and designed formulas accordingly. I can't tell you exactly what requirements they had in mind, but I can look at the implementation and guess that they wanted a system along these lines:

  1. Scores shouldn't need to be recomputed unless the number of votes change. This reduces the number of changes to the database, and makes it easier to achieve consistency if data is replicated. (So any scoring system based on scores getting lower as the article ages will be no good).

  2. If two stories are equally old, the one with more upvotes should be higher. (So there needs to be a contribution from the votes.)

  3. The more upvotes a story gets, the longer it should remain near the top of the ranking.

  4. Old stories shouldn't stay at the top of the rankings for ever, even if they had lots of upvotes. Fairly soon (after a day or two), new stories need to outrank them. (So there needs to be a contribution from the date, and this must outweigh the score due to votes fairly soon, no matter how many votes something gets.)

  5. Stories with more downvotes than upvotes should not appear in the rankings at all.

Now let's look at the formula: log z + yt / 45000 and see how it satisfies these requirements.

  1. If the number of votes does not change, then z, y and t are all unchanged. So the score is unchanged. This satisfies requirement (1).

  2. If two stories have the same age, then they have the same value for t. But the one with more upvotes has a higher value of z, and since log is monotonic, it has a higher score. This satisfies requirement (2).

  3. The more upvotes a story has, the higher its z, so the longer it will be until another story with higher t can outrank it. This satisfies requirement (3).

  4. Logarithm is a function that grows more slowly as it gets larger (take a look at its graph). So a story needs more and more upvotes over time to keep up with newer stories. This satisfies requirement (4).

  5. If the story has more downvotes than upvotes, then z = 1 and y = −1 so the score is negative. This satisfies requirement (5).

The constant 45,000 is a scale factor that brings the upvotes and the age into balance. There are 86,400 seconds in a day, so t gets larger by this amount each day. Dividing t by 45,000 gives 1.92 which means that one day's relative newness is worth is 101.92 = 83 votes, and two days' relative newness are worth roughly 7,000 votes.

Heeled answered 3/7, 2011 at 23:13 Comment(0)
C
2

They don't come from anywhere. There is no absolute truth to them, nor anything to prove. It's simply a way to quantify an attribute in as most sensible a way as seemed to the development team.

You would use log when you want something to be a factor although a less important one (since large values indeed grow, although very slowly). But by the same token, they could have chosen cube root.

The formulae are simply a representation of those factors which we can presume are those which characteristically belong to something "hot", and a composition of them in such a manner that takes each into account in an appropriate proportion (for example, we'll square those values that have huge importance, and take log of those which are less).

Once they came up with the formula, they probably came up with 10 or 15 different types of posts and plugged the numbers in and saw that that made a lot of sense all round, so stuck with it. In fact, there first few attempts probably didn't come out so well, and after a little fiddling with the numbers arrived at that formula.

Cashbox answered 3/7, 2011 at 23:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.