10

It would be neat to see which answers have the largest divide over up-votes/down-votes. Sorting them by their controversial status, that is.

  • Has anyone asked the data dump have common this is? – dmckee --- ex-moderator kitten Jul 27 '09 at 22:39
  • Greasemonkey script, Jonathan? – deleted Jul 27 '09 at 23:08
  • @Isaac, I would take care of it if they served up the number of upvotes to downvotes. But unfortunately we only get to see the resulting value. – Sampson Jul 27 '09 at 23:47
  • You can view all votes from the dump, would be slightly outdated for somethings but should be effective for most of the large wikis. – Ian Elliott Jul 28 '09 at 0:08
  • I don't like having to click on each and every answer to see the controversy: Backlink to my recent question: meta.stackexchange.com/q/263866/150133 – goodguys_activate Aug 19 '15 at 2:16
  • This can just be done on SEDE these days (updated weekly) using any formula you want. Here's my own from a while back, and there are many others. – Jason C May 28 '17 at 23:26
8

Sorting for this would be easy. Sort order would be the minimum of up votes and down votes (highest to lowest).

I don't think that's such a bad idea actually. But I do think if we had it we would need to be able to see upvotes and downvotes, not just net votes, even if it was just via a tooltip.

|improve this answer|||||
  • 1
    I agree - we would definitely need to see the two values. – Sampson Jul 28 '09 at 1:10
  • You would also need the privilege to view vote counts on posts. – OldBunny2800 May 29 '17 at 1:39
4

A simple formula would enable us to calculate the controversy percentage of one question:

(MIN(UpVotes,DownVotes)+1)/(MAX(UpVotes,DownVotes)+1)

Of course, one question would need over 4 votes or something similar in order to be eligible.

|improve this answer|||||
2

As controversial posts aren't seen as good, I don't think there's going to be an option to sort by controversy.

|improve this answer|||||
2

So, I don't generally like answering really old posts, and for the record (although it's a bit moot now, 8 years later) I don't support a "controversial" sort in the main UI for various reasons. However, this post got bumped recently, I really like data, I've done some digging into this myself in the past, and I'm, of course, interested in comparing all of the various algorithms posted here.

These days this is all possible in SEDE, which is updated weekly, and so, to that end I've put together this query, which combines:

The query has a lot of options. Here's a description:

Output:

  • creationdate, post link, id, views, score, upvotes, downvotes: post stats
  • AMrank, AMcont: rank and values from andrew moore's post
  • JCrank, JCcont: rank and values from jason c's query
  • RF1rank, RF1cont: rank and values from repfarmer's first equation
  • RF2rank, RF2cont: rank and values from repfarmer's second equation
  • SSrank: rank and values from sam.saffron's query (no SScont)

  • rank/cont will be null for results not returned by that algorithm. easiest way to sort is adjust the 'order by' in the very last line of this query.

parameters:

  • ExcludeQuestions non-zero to exclude questions
  • ExcludeCW non-zero to exclude community wiki
  • ExcludeClosed non-zero to exclude closed
  • ResultCount number of results per algorithm
  • AMMinVoteCount minimum number of total votes for andrew moore's equation

I slightly modified Andrew Moore's algorithm by further sorting posts with equal "controversy" in descending order of max(upvotes, downvotes).

To use this query, set the various options and run it. The *rank columns have a rank from 1 to ResultCount with 1 being the most controversial. You may click the column headers to change which rank you sort by (although you'll have to scroll to the bottom since null values come first) or you can just change the order by on the very last line of the query.

It's rather interesting to see the differences and overlap between everybody's algorithms.

Perhaps others will find this interesting.


Fwiw, the one I've used in the past, which is included in the above query, is:

MIN(upvotes, downvotes) - ABS(score)

There, "controversy" is determined by number of conflicting votes (min(up, down)) minus number of non-conflicting votes (abs(up - down)). Higher ranks tend towards more equal numbers of up and down votes, and total votes are also significant.


Here is the query itself, it's rather long:

-- comparison of the "controversial" algorithms from
--   https://meta.stackexchange.com/questions/10200/new-answer-sorting-controversial
--
-- output:
--
--   creationdate, post link, id, views, score, upvotes, downvotes: post stats
--   AMrank, AMcont: rank and values from andrew moore's post
--   JCrank, JCcont: rank and values from jason c's query
--   RF1rank, RF1cont: rank and values from repfarmer's first equation
--   RF2rank, RF2cont: rank and values from repfarmer's second equation
--   SSrank: rank and values from sam.saffron's query (no SScont)
--
--   rank/cont will be null for results not returned by that algorithm.
--   easiest way to sort is adjust the 'order by' in the very last line of
--   this query.
--
-- parameters:
--
--   ExcludeQuestions non-zero to exclude questions
--   ExcludeCW  non-zero to exclude community wiki
--   ExcludeClosed non-zero to exclude closed
--   ResultCount number of results per algorithm
--   AMMinVoteCount minimum number of total votes for andrew moore's equation
--
-- https://stackexchange.com/users/305991/jason-c

-- posts with voting data (converted to floats for convenience below)
with postvotes as (
  select
    p.id,
    p.creationdate,
    convert(float, p.score) score,
    convert(float, coalesce(p.viewcount, parent.viewcount)) views,
    convert(float, sum(iif(v.votetypeid = 2, 1, 0))) upvotes,
    convert(float, sum(iif(v.votetypeid = 3, 1, 0))) downvotes
  from
    posts p
    left outer join posts parent on parent.id = p.parentid
    left outer join votes v on v.postid = p.id 
  where
    (p.posttypeid = 2 or (##ExcludeQuestions?0## = 0 and p.posttypeid = 1))
    and (##ExcludeCW?0## = 0 or p.communityowneddate is null)
    and (##ExcludeClosed?0## = 0 or p.closeddate is null)
  group by
    p.id, p.score, p.creationdate, p.viewcount, parent.viewcount
),

-- https://meta.stackexchange.com/a/10570/230261
-- (MIN(UpVotes,DownVotes)+1)/(MAX(UpVotes,DownVotes)+1)
andrewmoore as (
  select top ##ResultCount?100##
    id,
    row_number() over (order by a / b desc, b desc, id desc) rank,
    a / b cont
  from (
    select
      *,
      iif(upvotes < downvotes, upvotes, downvotes) + 1 a,
      iif(upvotes > downvotes, upvotes, downvotes) + 1 b
    from
      postvotes
    where
      upvotes + downvotes > ##AMMinVoteCount?4##
    ) x
  order by
    rank
),

-- http://data.stackexchange.com/stackoverflow/query/214009/most-controversial-posts
--  MIN(up,down) - ABS(score)
jasonc as (
  select top ##ResultCount?100##
    id,
    row_number() over (order by cont desc, id desc) rank,
    cont
  from (
    select
      *,
      iif(upvotes < downvotes, upvotes, downvotes) - abs(score) cont
    from
      postvotes
    ) x
  order by
    rank
),

-- first equation from https://meta.stackexchange.com/a/280383/230261 
-- (downvotes + upvotes) / (absolute_value(score) + 1)
repfarmer1 as (
  select top ##ResultCount?100##
    id,
    row_number() over (order by cont desc, id desc) rank,
    cont
  from (
    select
      *,
      (downvotes + upvotes) / (abs(score) + 1) cont
    from
      postvotes
    ) x
  order by
    rank
),

-- second equation from https://meta.stackexchange.com/a/280383/230261 
-- (downvotes + upvotes) / (absolute_value(views * score) + 1) * (upvotes + downvotes)
repfarmer2 as (
  select top ##ResultCount?100##
    id,
    row_number() over (order by cont desc, id desc) rank,
    cont
  from (
    select
      *,
      (downvotes + upvotes) / (abs(views * score) + 1) * (downvotes + upvotes) cont
    from
      postvotes
    ) x
  order by
    rank
),

-- sam.saffron's popular sede query:
-- http://data.stackexchange.com/stackoverflow/query/466/most-controversial-posts-on-the-site
-- Looks for posts with more than half the amount of downvotes as they have upvotes 
-- Ordered by upvotes
samsaffron as (
  select top ##ResultCount?100##
    id,
    row_number() over (order by upvotes desc, id desc) rank,
    0 cont
  from
    postvotes
  where
    downvotes > (upvotes * 0.5) 
  order by
    upvotes desc, id desc
),

-- the ids of every post returned by all algorithms
allcposts as (
  select distinct
    id
  from (
    select * from andrewmoore
    union all select * from jasonc
    union all select * from repfarmer1
    union all select * from repfarmer2
    union all select * from samsaffron
  ) x
)

-- the final results
select
  p.creationdate,
  p.id [Post Link],
  p.score,
  p.upvotes,
  p.downvotes,
  p.views,
  am.rank AMrank,
  jc.rank JCrank,
  rf1.rank RF1rank,
  rf2.rank RF2rank,
  ss.rank SSrank,
  am.cont AMcont,
  jc.cont JCcont,
  rf1.cont RF1cont,
  rf2.cont RF2cont
from
  allcposts c
  inner join postvotes p on p.id = c.id
  left outer join andrewmoore am on am.id = c.id
  left outer join jasonc jc on jc.id = c.id
  left outer join repfarmer1 rf1 on rf1.id = c.id
  left outer join repfarmer2 rf2 on rf2.id = c.id
  left outer join samsaffron ss on ss.id = c.id
order by 
  coalesce(jc.rank, ##ResultCount## + 1) asc -- put nulls at end
|improve this answer|||||
1

This would be cool to see for questions and answers. This is a possible badge idea too. "controversial question" and "controversial answer" for like 10 up and 10 down votes.

|improve this answer|||||
  • 4
    This has been shot down several time and for good reason: it would encourage trolling. – dmckee --- ex-moderator kitten Jul 27 '09 at 23:28
  • I guess the more I think about it, you are right. Sometime you really got to make sure to think about your ideas from every single angle good and bad. – Troggy Jul 27 '09 at 23:46
  • Well, 'ya know: it sounds good at first. And if you managed it with a serious answer it would be an accomplishment. – dmckee --- ex-moderator kitten Jul 28 '09 at 1:29
1

I sort of touched on this on the blog; reddit changed their sorts to partially disable the effect of controversial posts.

http://blog.stackoverflow.com/2009/10/alternate-sorting-orders/

|improve this answer|||||
0

I'm not sure how your algorithm would work exactly...

If you imagine the "divide" in terms of a number line:

<----------------------DOWN------0----------------UP-------------------->

You could see that the "divide" could be the total number of votes (say 4 downs and 5 ups = 9 votes)

But, in theory something with 0 down votes and 10 upvotes would rank higher because the total would be 10. The same could be said for something voted down 10 times and upvoted 0.

How would you reconcile this in your idea of great "divide?"

|improve this answer|||||
  • Digg currently has an algorithm for this. Without much thought, I'm not immediately sure how it would be best acheived. I'll give it some thought :) – Sampson Jul 27 '09 at 23:49
  • 3
    ABS(UpVotes-DownVotes), closer to zero, the more controversial. – Ian Elliott Jul 28 '09 at 0:08
  • @Ian Elliott: I'm more tempted to use (UpVotes+1)/(DownVotes+1)... [The plus one to remove the possibility of Div Per 0). That way the number of votes doesn't affect the score it gets. Closer to zero, more controversial. – Andrew Moore Jul 28 '09 at 0:29
  • @Andrew: That won't work, putting a divisor in the mix will skew the values as x/y approaches 1 . 40/30 > 35/35 > 30/40 , but 35/35 is clearly more controversial. Albeit my formula isn't perfect either, but it's the best you can get with a simple equation. I may be interested in formulating something more accurate later. – Ian Elliott Jul 28 '09 at 0:53
  • @Ian Elliott: I meant closer to one is more controversial. The zero was a typo. Actually, to improve a bit on my previous statement: (MIN(UpVotes,DownVotes)+1)/(MAX(UpVotes,DownVotes)+1). That way, you always have a value between 0 and 1... See it as the controversy percentage. – Andrew Moore Jul 28 '09 at 1:26
  • Of course, you want a minimum number of votes to be eligible. – Andrew Moore Jul 28 '09 at 1:29
-3

Here's an equation to do it:

controversy = (downvotes + upvotes) / (absolute_value(score) + 1)

A post with 17 upvotes and 1 downvote has a controversy score of 1.125.

A post win 29 upvotes and 32 downvotes has a controversy score of 20.333.

Here's an alternative equation if you want to factor in popularity:

controversy = (downvotes + upvotes) / (absolute_value(views * score) + 1) * (upvotes + downvotes)

A post with 0 upvotes, 1952 downvotes, and 5000 views has a controversy score of 0.3902.

A post with 128 upvotes, 127 downvotes, and 320 views has a controversy score of 204.8.


EDIT: The "plus 1" is to avoid dividing by zero, which would result in a controversy score of infinity.


EDIT: How big the controversy numbers are doesn't matter, because you're only sorting it.


|improve this answer|||||
  • 3
    Assume dividing by zero means "infinite controversy", hmm? Well, let's think about what would send the denominator to zero: if the upvotes and downvotes are balanced, sure, even if there is none of either. You're saying literally every single post which has never been voted on is "infinitely controversial". Posh. What was your purpose in posting this "equation"? – Dan Bron Jun 18 '16 at 1:05
  • @DanBron Oops, I didn't notice that. I edited the post to fix the issue. – clickbait Aug 2 '16 at 1:02
  • hmm. Last edit seems... incorrect. Also, time for a SEDE query? – Journeyman Geek May 28 '17 at 23:43
  • @JourneymanGeek Already done you just wait I got a good one coming. – Jason C May 29 '17 at 0:20
  • "EDIT: Sorry, I didn't know that this is only for answers and not questions, so I deleted this post. " is incorrect ;p. Fixed! – Journeyman Geek May 29 '17 at 0:22
  • @JasonC I did a rollback to fix it, thanks for pointing that out. – clickbait May 29 '17 at 0:22
  • @JourneymanGeek meta.stackexchange.com/a/296512/230261 Woohoo, data! – Jason C May 29 '17 at 1:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .