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.

tl;dr (summary)

I'm a beginner in mathematics. My question is: is there a formula to calculate the right column in the following table based on the values of the left column?

$$ \begin{array}{|c|c|} \hline {\rm AwardedCount} & {\rm CalculatedScore} & {\rm ExpectedScore} \\ \hline 1303591 & 10 & 10 \\ \hline 108023 & 186 & 125 \\ \hline other data & … & … \\ \hline 12114 & 339 & 250 \\ \hline 20 & 790 & 500 \\ \hline 1 & 1000 & 1000 \\ \hline \end{array} $$

Note that they are only examples of expected values, I just want to show the distribution I want at the end.

The ExpectedScore value should be: $ExpectedScore = [10, 1000]$

The middle column show the score I was able to calculate. The formula I currently use is (thanks to MPW and Brian Rushton):

$$ CalculatedScore = \Big(\big(1 - \log(AwardedCount; MaxAwardedCount)\big) \times 990 \Big) + 10 $$

The $log()$ function use two arguments, the first is the input value and the second is the base, hereby MaxAwardedCount.

This formula is what I was looking for, but I keep this question opened just in case someone have a simpler idea.

Original question with details

(Adjust scores based on rarity)

I'm working on a personal project which involves calculating scores based on badges earned on StackExchange badges. I want to calculate a score from 1 to 1000 based on the rarity of a badge. A badge awarded to a few users (eg. only one user) should have a score of 1000. A badge awarded to a numerous users should have a lower score (always greater or equal to 1).

Let's take some examples:

Current method

My formula is :

$$ Score = \frac{\frac{MaxAwardedCount}{AwardedCount}}{MaxAwardedCount} \times 1000 = \frac{1000}{AwardedCount} $$

The value is then rounded to the superior integer value.

Results

The Famous Question badge, most earned (108023 times): $\frac{1000}{108023} = 0.009257 \approx 1$

A rare badge, awarded only 20 times: $\frac{1000}{20} = 50$

A rare badge, awarded only twice: $\frac{1000}{2} = 500$

A rarest badge, awarded only once: $\frac{1000}{1} = 1000$

Expectation

The problem is that it gives significant scores only to rare badges. Is it possible to find a formula which will give bigger scores even to more common badges?

Plus, a badge earned 10 times on sites A and B is more valuable on site A if A have more users than B (it is less frequent on A than on B). So the score has to been adjusted depending on the MaxAwardedCount value for each site.

To go further, would it be interesting to calculate the mean of the award count of each badge in order to give a score of about 500 to the badge which are never rare nor frequent? Since I got all the data from StackOverflow badges, I have calculated that the average of AwardedCount is 2451.6115. Is it possible to give an arbitrary score of 500 to this badge, then calculate the score of all the other badges?

I don't know much about mathematics so please use only simple words.

share|improve this question
    
You use the normal-distribution tag --- do you know what the "normal distribution" is? You make no reference to it in the question, so far as I can see. –  Gerry Myerson Jan 11 at 3:43
    
I know the tag is not appropriate to my question but it was the closest I found which corresponded to my goal: create a distribution of numbers calculated from the sequence of numbers. You can't edit my question and remove the if you think it's bad to use it. –  A.L Jan 11 at 3:48
    
Then it sounds like there's no probability involved in the question at all, just an attempt to engineer a formula to explain some outputs. I'll edit the tags. –  Gerry Myerson Jan 11 at 3:51

2 Answers 2

up vote 1 down vote accepted
+50

I recommend imitating reddit and using a logarithmic scale. So take $-\log(awarded/maxawarded)$ and scale it to 1000. This makes the difference between very rare and average much smaller.

Edit: So the real formula would be $10-(990/14)\ln(awarded/1303591)$.

share|improve this answer
    
Thanks for your answer. A $ is missing after your formula. I don't want to edit your answer just for one character. –  A.L Jan 11 at 18:35
    
This answer fits my need. I modified the formula as $Score = ((1- \frac{log(AwardedCount)}{log(MaxAwardedCount)}) \times 990 + 10)$ and the result is the one I expected. –  A.L Jan 11 at 18:47
    
Can the formula in my comment above be simplified? –  A.L Jan 11 at 18:53
    
Please explain what is 14 in the formula you added in your answer. –  A.L Jan 11 at 18:54
1  
The formula above has been simplified to: $Score = ((1 − \log{AwardedCount; MaxAwardedCount}) \times 990 + 10)$ (the second argument of the $\log{}$ is the base of the log). –  A.L Jan 11 at 19:30

Is this difficult? The frequency $f$ of a badge could be thought of as a number from $0$ (no user has earned it) to $1$ (every user has earned it). So pick your favorite decreasing bijection $r:[0,1]\rightarrow [0,1]$ (such as $r(x)= 1-x$) and you have a measure of rarity. Scale and translate if you really want the range to be $[1,1000]$ (so use $1 + 999r$). I'm thinking you would calculate the frequency $f$ in the obvious way as (# users with the badge)/(# users). Then $r(f)$ (or $1 + 999r(f)$ if desired) is what you want.

You could tweak the bijection I suggest by trying $r_{\alpha}(x) = 1 - x^\alpha$, et cetera. Pick the function you want to control the behavior as you desire.

share|improve this answer
    
Well it't not about frequency, it's about rarity, so more like: #users without / #users. –  Nameless Jan 8 at 2:18
    
@Nameless: Rarity and frequency are complementary. That's what $r$ does. In my simple example, note that 1 - with/users = without/users. –  MPW Jan 8 at 2:23
    
@Nameless: Perhaps I wasn't clear on how $r$ was to be used. I have edited the answer to add that clarification. Apologies. –  MPW Jan 8 at 2:29
    
@MPW : I'm sorry but I don't understand most of your answer. favorite decreasing bijection please give an example. And can you please give an example with a formula? I've updated my question with a table of expected results. –  A.L Jan 8 at 9:49
    
I don't know the number of users. –  A.L Jan 10 at 21:59

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.