Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Suppose I have a topic or discussion, and a number of "support" and "opposition" points on each side (You can also think of them as "upvotes" and "downvotes") and I want to calculate a score of how "controversial" a topic is. (Let $p$ be the support score, $c$ be the opposition score, and $f(p, c)$ be the function that determines the controversy score.)

It should have the following properties:

  • Controversy is maximized when equal support is given to both sides. Given that some property $g(p, c)$ is held constant (such that the slope of the tangent line of the level curve of $g(p, c)$ at any point is never positive), $f(p, c)$ should be maximized when $p = c$.
  • More support on both sides means that more people care and therefore there is more controversy. Given that $p/c$ is held constant, a higher value of $p$ or $c$ should result in a higher value of $f(p, c)$.
  • The amount of controversy is the same for the same imbalance of support no matter which side the imbalance favours. $f(p, c)$ should equal $f(c, p)$.
  • All the support being on one side means there is no controversy. Given that either $p$ or $c$ is equal to zero, $f(p, c)$ should be equal to zero.

Is there any function like this that is already in use? If not, could one be devised?

share|improve this question
    
Basically I'm trying to simulate or find a better formula for Reddit's "controversial" section. That section doesn't even seem to work properly on most subreddits I visit. –  Joe Z. Mar 2 '13 at 15:02
    
Selecting it on All made me realize that Controversial takes pretty much anything whose score is between 1 and -1 with more than 4 votes total. –  Joe Z. Mar 2 '13 at 15:09
    
Here's a related question on Stack Overflow that asks the same thing. But I'm interested in it mathematically as well. –  Joe Z. Mar 6 '13 at 2:39

4 Answers 4

up vote 5 down vote accepted

$$f = \min$$


More generally, choose an even function $g:[-1,1]\to\mathbb R_{\ge0}$ such that $g(-1)=g(1)=0$, and an increasing function $h:\mathbb R_{\ge0}\to\mathbb R_{\ge0}$, and let $$f(p,c)=g\left(\frac{p-c}{p+c}\right)h\left(\frac{p+c}2\right).$$ Here $g$ controls the "cross-section" for a fixed number of votes, while $h$ controls the growth for a fixed $p/c$ ratio. For example, $f(p,c)=\min(p,c)$ arises from setting $g(x)=1-\lvert x\rvert$ and $h(y)=y$. @michielm's solution $f(p,c)=pc/\lvert p-c\rvert$ corresponds to $g(x)=(1-x^2)/\lvert x\rvert$, $h(y)=y/2$. Another nice solution is $g(x)=\sqrt{1-x^2}, h(y)=y \implies f(p,c)=\sqrt{pc}$.

share|improve this answer
    
+1 and accept for the general formula class. –  Joe Z. Mar 2 '13 at 15:49

What about $\frac{p c}{|p-c|}$?

This will grow (to infinity) for $c$ and $p$ being closer together and will also grow if $p/c=constant$ with increased $p c$. All support on one side will mean that $pc$ is low (or 0)

Maybe it is not perfect in its general behaviour, but the limiting behaviour seems to be right, so you can probably go from here.

share|improve this answer
1  
I'm not sure 1 upvote vs. 1 downvote resulting in the same amount as 100 vs. 100 (both of which are "infinite") is a good idea. But thanks anyway. –  Joe Z. Mar 2 '13 at 8:31
2  
A little adjustment like $\frac{pc}{|p-c|+1}$ would avoid infinity. –  Hagen von Eitzen Mar 2 '13 at 9:43

I would argue that a simple and natural measure of controversy is simply the product of the support vote count $p$ and the opposed vote count $c$:

$$f(p,c) = pc$$

In particular, for a fixed total number of votes $p+c$, $f$ is maximized at $p = c$ (or at $p = c \pm 1$ if the total is odd), and it also satisfies your requirements 2–4. It also has the convenient property that $f(p,c)$ is a non-negative integer whenever $p$ and $c$ are.

One downside is that, for a fixed vote ratio $0 < p/c < \infty$, $f(p,c)$ grows proportionally to the square of the total number of votes $p+c$. If you'd prefer a linearly growing function instead, you can always take the square root to get the geometric mean of $p$ and $c$:

$$f^*(p,c) = \sqrt{pc}$$

As the square root is a strictly monotone increasing function, it does not affect the relative ranking of the results: $f(p,c) > f(p',c')$ if and only if $f^*(p,c) > f^*(p',c')$. However, by the AM–GM inequality, we can see that $f^*(p,c)$ can never exceed half of the total vote count $p+c$.

share|improve this answer
    
One problem with using $pc$ is that there are certain $g(p, c)$ for which the maximum value isn't at $p = c$. Originally I wanted to use $\displaystyle \frac{2pc}{p+c}$, but then I realized that if either $p$ or $c$ is constant, $f(p, c)$ actually grows when $p$ increases past $c$ or vice versa. –  Joe Z. Mar 2 '13 at 14:55
1  
@Joe: Indeed, your full criterion 1 as stated is quite hard to satisfy. In particular, considering the "worst-case" test function $g(p,c)=\min(p,c)$ shows that no function $f(p,c)$ that satisfies both criteria 1 and 2 can be differentiable at points where $p=c$. –  Ilmari Karonen Mar 2 '13 at 15:03
    
I had a hunch that was the case. The function I've come up with now is not differentiable on $p = c$ either. –  Joe Z. Mar 2 '13 at 15:04

The formula I came up with myself was: $\displaystyle \frac{\min(p,c)^2}{\max(p, c)}$

I called it the "geometric progression" algorithm, because it represents the next term of the geometric progression lower than $\max(p,c)$ and $\min(p, c)$. In this way, as $p$ increases past $c$, $f(p, c)$ will get smaller, reaching its maximum of $c$ when $p = c$.

It also has the additional scaling property that the number of votes on $\max(p,c)$ varies inversely with $f(p, c)$.

share|improve this answer
    
I created a page where you can play with various upvote and downvote algorithms, with this formula on it. –  Joe Z. Mar 2 '13 at 16:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.