I have a dataset of bets made in a betting game. I want to rank the different players in the game based on total dollar value of bets they have made and number of bets they have made.

I want to come up with a function which gives a high score to users which have high total amount bet but simultaneously punishes small, crappy bets. For instance, User A who made 10 1 dollar bets should have a smaller score than User B who made just 1 10 dollar bet.

I can do that by simply taking the average amount spent per transaction and normalising it against the max of the averages.

enter image description here

However, the dataset I have is very skewed. The max mean value is too large and that results in extremely low scores for >95% of the users.

In the scheme I mentioned, I want User A to have a less score than User B but not an order of magnitude less. That is if user B is given score 0.9 by the function, I want user A to have something more along 0.80.

I want to know what is the thought process that you should have while coming up with such a function (e.g. when to use log of a variable, when to use an exponential etc).

Any help appreciated. Thanks!


1 Answer 1


Define, for every player $i \in \{1, 2, \ldots, n\}$:

  • $n_i$: the number of bets made by player $i$;
  • $d_i$: total amount of dollars spent by player $i$;
  • $a_i = \frac{d_i}{n_i}$: the average dollars per bet spent by player $i$.

You want to score players according to the $a_i$ values; the problem, as you stated, is that values $a_i$ can assume very different values, ranging in the interval $[0, +\infty[$. When encountering this type of data, one possibility is to transform them into a finite range, e.g., the unitary interval $[0,1]$.

To do this, I usually start by defining the requisites the transformation function $\phi(x)$ must satisfy:

  • $\phi(x)$ is defined for $x \in [0, +\infty[$,
  • $\phi(0) = 0$,
  • $\displaystyle\lim_{x \to +\infty}\phi(x) = 1$,
  • $\phi(x)$ must be continuous,
  • $\phi(x)$ must be increasing,
  • $\phi(x)$ must have negative second derivative (in order to make the small values weight more).

At this point you see that suitable elementary function are logarithms or exponentials. For instance, we could define: $$ \phi(x) = 1-e^{-k\cdot x}, $$ where $k \in \mathbb{R}$ is a parameter you can play with to find the best value for your dataset.

With this choice for $\phi(x)$, your score $s_i$ for player $i$ becomes $$ s_i = \displaystyle\frac{1-e^{-k\cdot a_i}}{\displaystyle \max_{j \in \{1, 2, \ldots, n\}} 1-e^{-k\cdot a_j}}. $$


You must log in to answer this question.

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