I'm working on a ranking system that will rank entries based on votes that have been cast over a period of time. I'm looking for an algorithm that will calculate a score which is kinda like an average, however I would like it to favor newer scores over older ones. I was thinking of something along the line of:

$$\frac{\mathrm{score}_1 +\ 2\cdot \mathrm{score}_2\ +\ \dots +\ n\cdot \mathrm{score}_n}{1 + 2 + \dots + n}$$

I was wondering if there were other algorithms which are usually used for situations like this and if so, could you please explain them?


You could use any function that gives a lower weight to older entries. For example, if data consists of scores, $s_1,\ldots,s_n$, where the index corresponds to the 'time of arrival' of the entry, that is, newer entries have larger indices, then you could use a weight function that increase as $i$ increases. So any 'increasing' function will do. Examples include:

  • $f(x)=e^x$
  • $f(x)=\log x$
  • $f(x)=x$
  • $f(x)=x^2$


Then your function will be

$\dfrac{\sum_{i=1}^n s_i\cdot f(i)}{\sum_{i=1}^n f(i)}$.

Actually, it makes more sense to give the newest entry the lowest index and make the weight function decreasing. This way you can tune it by setting the weighting that you want to give to the first element.

Wikipedia has an entry on weight functions, some examples can be found on the page about weighted means.

  • $\begingroup$ thank you very much, this was what I was looking for. Very informative $\endgroup$ Apr 23 '12 at 23:09
  • $\begingroup$ I have one quick question, I know that '∑i' is the sum of 'i' and 'f(i)' is the function(like 'f(x)=logx') with respect to 'i'. But what does 'si' represent? many thanks for your help $\endgroup$ Apr 24 '12 at 5:33
  • 1
    $\begingroup$ $s_i$ are your scores. $\endgroup$ Apr 24 '12 at 5:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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