# What formula should be used to determine “hot” questions?

Right now the front page Popular tab is fairly broken -- it's a simple descending sort by views. As Joel said in podcast #18, it is "a self-fulfilling prophecy." But this is not intentional, it's only because we haven't had time to improve it yet!

As I sit down to write a better algorithm, I thought you guys might have some insight into what would make a good formula to determine the "hot" questions -- over the last 24 hours, the last week, the last month, and all time.

Here are the variables we have to work with:

• Views
• Whether the question has an accepted answer or not
• Time question was originally asked
• Time of last activity on question

Joel cited the reddit formula as an example, but I think our site is a little different than just a basic link submission site. Plus, we have more variables and data to work with.

I found a blog post describing a few formulas:

Y Combinator Hacker News

(p - 1) / (t + 2)^1.5

p = votes (points) from users
t = time since submission in hours

Reddit

t = (time of entry post) - (Dec 8, 2005)

y = {1 if x > 0, 0 if x = 0, -1 if x < 0)
z = {1 if x < 0, otherwise x}

log(z) + (y * t)/45000

Thoughts? Ideas? I don't want to overthink this; I just want the "hot" questions to be relevant and useful to us. So the simpler the algorithm the better!

Based on my analysis of the above and the comments so far, here's the second version of what I have implemented so far. This might suck. I don't know:

```(log(Qviews)*4) + ((Qanswers * Qscore)/5) + sum(Ascores)
--------------------------------------------------------
((QageInHours+1) - ((QageInHours - Qupdated)/2)) ^ 1.5
```

Note that accepted answers weight not at all in hotness. This is intentional, as I feel accepted answers are a fine social contract, but not a good data point for question or answer quality.

This algorithm will heavily favor questions with LOTS of answers, as the sum(Ascores) are now included -- one assumes if there are lots of answers, there will be a lot more voting on the answers, too.

Update: Note that this formula is what is used on the hot tab linked from the homepage of each site. It is not the formula used to determine the network hot list. See How do the “arbitrary hotness points” work on the new Stack Exchange home page?.

• @Jeff Atwood: What units is the age in? It wouldn't matter if the age variables weren't mutated, so units become very important. I'm guessing days, but it could be anything less than a day (assuming that days are in integral units and rounded down?) assuming you don't want the age value to drop below 1 (so that when raised to a power, it doesn't lower itself). – casperOne Feb 25 '10 at 3:05
• @casper it's in hours – Jeff Atwood May 2 '10 at 9:09
• @Jeff, I think an important factor to measure (which will lessen the effect of "self fulfilling prophecy"), is how long did a person stay in a discussion. I assume that not-so-interesting discussions might have many views (since they are considered hot, and were advertised in reddit), but people will close the tab short time after they read the first few lines. – Elazar Leibovich Jun 25 '10 at 5:10
• This question needs updating: meta.stackexchange.com/questions/60756/…. – tshepang Jan 17 '11 at 10:15
• @tshe the SE.com algorithm is a bit different, this is documenting the hot algorithm on the sites themselves – Jeff Atwood Jan 17 '11 at 21:12
• @JeffAtwood: is this still true? – Trufa Apr 1 '11 at 3:32
• @JeffAtwood:Qupdated mean is the last activity time to the current time? – Charlie Apr 2 '11 at 1:51
• Are negative Ascores zeroed or abs()'d, or does a bad answer decrease the hotness? – Bryan Agee Aug 12 '11 at 22:45
• The increase of hotness due to presence of answers is very counter-productive, since this basically turns questions that are probably too broad or over-answered into "hot questions" - questions like this one. You should consider both a lack of answers and an overpresence of these to be bad – Tobias Kienzler Aug 2 '13 at 9:44
• – gnat Feb 26 '14 at 11:22
• would like to see an algorithm that is not highly unstable & changes every time browser page is reloaded as in current behavior! seems not to be selecting top questions by any deterministic algorithm in that case.... – vzn Apr 2 '14 at 16:00

Now the formula is

My Question is Can it be Made Better?

1. Log_10^Qviews*4 = log_1.74^Qviews

I think changing to log_2^Qviews will be more beautiful.

I think the Qanswers shouldn't be considered, because most computer programming questions are not open-ended questions.

If the question have answers, the value should be 1.

If the question don't have any answers, the value should be 0

I think change to [if answered]*Qscore will be more suitable.

3.sum(Ascores)

For example: