# User Flagging Ratio report scores

**URL:** https://meta.discourse.org/t/user-flagging-ratio-report-scores/128430
**Category:** Site feedback
**Created:** [September 12, 2019, 6:02pm UTC](https://meta.discourse.org/t/user-flagging-ratio-report-scores/128430 "2019-09-12T18:02:39Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![cvx](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cvx/32/152146_2.png) [@cvx](https://meta.discourse.org/u/cvx)
#### Post date: [September 12, 2019, 6:02pm UTC](https://meta.discourse.org/t/user-flagging-ratio-report-scores/128430/1 "2019-09-12T18:02:39Z")

</div>

Scores in the User Flagging Ratio report seem a bit confusing. 🙂

For example:

- Users with only disagreed flags are scored above those with no flags, and above those who have a similar amount of agreed and disagreed.
- Those with e.g. 100 disagreed and 100 agreed are scored exactly the same as someone with no flags, at 0.

What’s the intention behind this score? (cc: @j.jaffeux)

* * *

The current formula for each score is:

```ruby
if disagreed == 0
  agreed * agreed
else
  ((1 - (agreed / disagreed)) * (disagreed - agreed)).to_i

```

_source: [app/models/reports/user\_flagging\_ratio.rb](https://github.com/discourse/discourse/blob/95a9a544c9a3d9a39a16bf41e6eb2e23d64edb4c/app/models/reports/user_flagging_ratio.rb#L57-L58)_

Here’s an example of scores for 0, 5, 10, and 15 agreed and disagreed flags:

```plaintext
   | 0 5 10 15 agreed
------------------------
0 | 0 25 100 225
   |
5 | 5 0 5 20
   |
10 | 10 2 0 2
   |
15 | 15 6 1 0
   |
disagreed

```

And that’s how it looks if you throw that formula into Wolfram Alpha. 😉 (`x` is agreed, and `y` is disagreed)

 ![image](https://global.discourse-cdn.com/meta/original/3X/f/9/f9366194c047c83fe172047fa6e92df2e42b1dd2.png)

_edit:_

Most recent changes to this algorithm are mentioned here: [User\_flagging\_ratio\_count - #8 by j.jaffeux](https://meta.discourse.org/t/user-flagging-ratio-count/117729/8)

---

<div class="post-metadata">

### Author: ![orenwolf](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/orenwolf/32/119529_2.png) [@orenwolf](https://meta.discourse.org/u/orenwolf)
#### Post date: [September 12, 2019, 6:13pm UTC](https://meta.discourse.org/t/user-flagging-ratio-report-scores/128430/2 "2019-09-12T18:13:13Z")

</div>

My use case for this particular report is to identify users who are most, or least, aligned with moderation. From that perspective, 15/0 and 0/15 are equally important for different reasons, and a score of 255 / -255 in those cases I think would make the situation much more precise, but I’m not sure how the algorithm could do that while also weighting for flag volume as well, which us equally important.

---

<div class="post-metadata">

### Author: ![lucasbasquerotto](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lucasbasquerotto/32/133376_2.png) [@lucasbasquerotto](https://meta.discourse.org/u/lucasbasquerotto)
#### Post date: [September 12, 2019, 6:25pm UTC](https://meta.discourse.org/t/user-flagging-ratio-report-scores/128430/3 "2019-09-12T18:25:24Z")

</div>

Wow, that means that keeping the `agreed` number constant, as the `disagreed` number increases, the score will be better and better (when `disagreed` \> `agreed`).

A more reasonable and direct formula may be something like:

`(agreed * agreed) - (disagreed * disagreed)`

That is, the agreed will always make the score higher, and the disagreed will always make it lower. I don’t know if there is a need to make the formula more complex than that, but anyway, just my opinion (if it’s ok for the score to be negative).

> [@cvx](#):
>
> Those with e.g. 100 disagreed and 100 agreed are scored exactly the same as someone with no flags, at 0.

I think this is okay, though. Is there a problem with it, considering that both values (one that should increase and the other that should decrease the score) are the same?

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [September 12, 2019, 6:48pm UTC](https://meta.discourse.org/t/user-flagging-ratio-report-scores/128430/4 "2019-09-12T18:48:56Z")

</div>

Didn’t write most of it, I mostly fixed a bug which was preventing to show records when you had more disagreed than agreed. So not sure about most of the logic. @eviltrout

I did the agreed \* agreed as it thought it would be interesting to emphasize users with which we never disagree. But this is edge case and most users won’t be in this bucket, so we should probably optimize the other branch.

Feel free to correct the formula to better handle any specific case this doesn’t take into account.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [September 13, 2019, 8:36am UTC](https://meta.discourse.org/t/user-flagging-ratio-report-scores/128430/5 "2019-09-13T08:36:53Z")

</div>

You should check with @eviltrout

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [September 13, 2019, 8:57pm UTC](https://meta.discourse.org/t/user-flagging-ratio-report-scores/128430/6 "2019-09-13T20:57:52Z")

</div>

I am definitely open to suggestion here. What would you suggest in its place?
