惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Security Archives - TechRepublic
Security Archives - TechRepublic
T
The Exploit Database - CXSecurity.com
P
Proofpoint News Feed
Scott Helme
Scott Helme
NISL@THU
NISL@THU
Cisco Talos Blog
Cisco Talos Blog
C
Cybersecurity and Infrastructure Security Agency CISA
AWS News Blog
AWS News Blog
V
Vulnerabilities – Threatpost
J
Java Code Geeks
U
Unit 42
The GitHub Blog
The GitHub Blog
H
Help Net Security
T
Tenable Blog
aimingoo的专栏
aimingoo的专栏
Jina AI
Jina AI
Spread Privacy
Spread Privacy
Apple Machine Learning Research
Apple Machine Learning Research
人人都是产品经理
人人都是产品经理
L
Lohrmann on Cybersecurity
T
Threatpost
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Engineering at Meta
Engineering at Meta
A
About on SuperTechFans
I
InfoQ
Microsoft Azure Blog
Microsoft Azure Blog
B
Blog
L
LINUX DO - 最新话题
K
Kaspersky official blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
T
Threat Research - Cisco Blogs
C
Check Point Blog
T
The Blog of Author Tim Ferriss
有赞技术团队
有赞技术团队
宝玉的分享
宝玉的分享
Help Net Security
Help Net Security
Google DeepMind News
Google DeepMind News
A
Arctic Wolf
Y
Y Combinator Blog
N
News | PayPal Newsroom
M
MIT News - Artificial intelligence
Latest news
Latest news
H
Hacker News: Front Page
Blog — PlanetScale
Blog — PlanetScale
腾讯CDC
I
Intezer
爱范儿
爱范儿
F
Fortinet All Blogs
P
Palo Alto Networks Blog
C
CERT Recently Published Vulnerability Notes

Evan Miller’s News

Likelihood-ratio inference on differences in quantiles Attention Is Off By One Formulas for Bootstrapping Sample Medians You Can’t Spell CUPED Without Frisch-Waugh-Lovell The Floppy Disk of Floating Point Formulas for Bayesian A/B Testing SlowerLogLog – Evan Miller Preface to A Lost Lady – Evan Miller Preface to Brave New World – Evan Miller Preface to The Time Machine – Evan Miller Preface to Frankenstein – Evan Miller A Stochastic Valuation Model – Evan Miller Things That Bother Me About Swift – Evan Miller Things That Bother Me About macOS – Evan Miller A Review of Perl 6 (Raku) – Evan Miller Why I’m Learning Perl 6 – Evan Miller Adventure Games and Eigenvalues – Evan Miller Microsoft Surface Studio and Giant Apple iPads – Evan Miller Type Punning Functions in C – Evan Miller Elixir RAM and the Template of Doom – Evan Miller Splatoon’s Ranking System Is Still Broken – Evan Miller Simple Sequential A/B Testing – Evan Miller Evaluating Splatoon’s Ranking System – Evan Miller Inferring Tweet Quality From Retweets – Evan Miller Deriving the Reddit Formula – Evan Miller A Taste of Rust Four Days of Go – Evan Miller
Ranking News Items With Upvotes – Evan Miller
Evan Miller · 2015-07-15 · via Evan Miller’s News

By Evan Miller

July 14, 2015

As a follow-up to Deriving the Reddit Formula, let’s consider a social news website that lets users upvote items, but that doesn’t permit them to downvote items. How can we infer the probability that a random user will upvote a story, given only the age of the story \(t\) and the total number of upvotes \(U\)?

To calculate that probability, we also need to know the total number of users visiting the site, call it \(N\). Of course, not all \(N\) users have seen a given story, so we first need an expression for the fraction of users who have seen a given story.

Following the model we used for Reddit users, if you think of a user’s reload behavior as a Poisson process with reload rate \(\lambda\), then the fraction of users who have seen a given story of age \(t\) is given by the formula:

\[ q = 1 - e^{-\lambda t} \]

(This is one minus the \(q\) from the previous model, which asked which fraction of users had not seen a given story.)

So the total number of users who have seen a given story is given by:

\[ n(t) = Nq = N(1-e^{-\lambda t}) \]

Therefore the fraction of users who upvoted a story — and therefore the expected probability of liking a story[1] — is given by:

\[ p = \frac{U}{n(t)} = \frac{U}{N(1-e^{-\lambda t})} \]

Assuming a user gets utility of +1 from a story that she would upvote, the expected utility from a story of age is just:

\[ u(t, U) = \frac{U}{N(1-e^{-\lambda t})} \]

To form an expectation, we need to multiply this quantity by the probability that the story hasn’t been seen before:

\[ E[u(t, U)] = e^{-\lambda t}\frac{U}{N(1-e^{-\lambda t})} \]

Now for a neat trick. Suppose we want to use the expected utility to rank news items. Because utility is relative, we can multiply or divide it by positive numbers without affecting the rankings. So let’s divide the above expression by the number of site users \(N\), which is a constant:

\[ E[u] = e^{-\lambda t}\frac{U}{1-e^{-\lambda t}} \]

That is, we can form a ranking using only \(U\) and \(t\) — it turns out there’s no need to know \(N\), the total number of users on the site!

We can also take a logarithm to make the formula comparable to the Reddit version:

\[ \ln E[u] = \ln(U) -\lambda t - \ln{(1-e^{-\lambda t})} \]

(To make the first logarithm work, you’ll need to give each story an automatic upvote to start life with — but then you’ll also want to set a minimum \(t\) before ranking so that the second logarithm doesn’t blow up. The C functions expm1 and log1p might come in handy here.)

The difference between this formula (which uses only upvotes) and the formula derived for Reddit (which includes both upvotes and downvotes) boils down to how we want to model the probability of upvoting something. Previously, we used the total number of votes, but here, we use the total number of visitors, using only what we know about the reload rate. As a consequence, the formulas are identical except that \(\ln{(U+D+2)}\) (the total number of votes, including two “automatic” votes) is replaced with \(\ln{(1-e^{-\lambda t})}\) (the fraction of users who have seen an item).

Example

To get a feel for the algorithm, let’s calculate the substitution rate between points and time required to maintain a constant ranking:

\[ \frac{dE[u]/dt}{dE[u]/U} = \frac{-\lambda U}{e^{\lambda t}-1} = \frac{-\Delta U}{\Delta t} \]

Which can be rewritten in terms of a fractional change in \(U\):

\[ \frac{\Delta U}{U} = \frac{\lambda \Delta t}{(e^{\lambda t} - 1)} \]

Let’s plug in some numbers to see how it works. Consider a reload rate of once per 4 hours \(\lambda = 1/4\) and a story that is 2 hours old. This formula reveals that a fractional change in \(U\) is equal to:

\[ \frac{\Delta U}{U} = \frac{\frac{1}{4} \Delta t}{(e^{1/2} - 1)} = 0.385 \Delta t \]

That is, to maintain its rank value in the next hour (\(\Delta t = 1\)), the story will need to accumulate 38.5% more upvotes. (Why is that figure less than 50%? In this model, later votes are more difficult to acquire than earlier votes. As time progresses, more and more users have already had the chance to vote on a given item, which means that later votes are in a sense more “valuable”.)

Conclusion

If you run a social news site, consider ranking your stories using a formal model rather than a hand-me-down formula whose origins were lost in the mists of time. The present model isn’t all that sophisticated, but it should provide a good starting point as you hone and tweak your site to provide just the right mix of things that are new and things that are good.


You’re reading evanmiller.org, a random collection of math, tech, and musings. If you liked this you might also enjoy:


Get new articles as they’re published, via LinkedIn, Twitter, or RSS.


Want to look for statistical patterns in your MySQL, PostgreSQL, or SQLite database? My desktop statistics software Wizard can help you analyze more data in less time and communicate discoveries visually without spending days struggling with pointless command syntax. Check it out!


Wizard
Statistics the Mac way


Back to Evan Miller’s home pageSubscribe to RSSLinkedInTwitter