开发者

Calculating normalized karma

开发者 https://www.devze.com 2022-12-15 23:01 出处:网络
How could I calculate a normalized value of karma (value between 0 and 1), from the karma of users in my system?

How could I calculate a normalized value of karma (value between 0 and 1), from the karma of users in my system?

The normalized value should reflect the value of the user's karma relative to all other user开发者_StackOverflow社区s.

I think I would probably have to include the average and standard deviations of all karma's somehow, but I can't seem to come up with the right formula.

Any help?


 min_karma = min(karmas)
 max_karma = max(karmas)
 normalized = (karma - min_karma) / (max_karma - min_karma)

This has the property that the user(s) with karma = min_karma get a normalised karma of 0, and users with karma = max_karma get 1. Others are linearly distributed in between. You will have to handle separately the special case that all users have the same karma.

If you want a non-linear distribution you could use a logarithmic function:

 normalized = (log(karma) - log(min_karma)) / (log(max_karma) - log(min_karma))

It is important in this case that the karma can never fall below 1, as this could skew the results.


you would want to calculate the percentile that each user belongs to. in mysql, you can do it like this:

http://forums.mysql.com/read.php?20,105223,105278#msg-105278

rank / total

where rank is the number of users with lower karma.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号