简体   繁体   中英

How to calculate rating based on two integer


could you help me how can I compare two integers? I try to make a rating based on soccer statistics. I have a basic formula, but I think it is not complete or not even good for this.

Formula: (a-b)/(a+b);

For ball possession seems good:

a=100, b=0,   rating= 1
a=75,  b=25,  rating= 0.5
a=50,  b=50,  rating= 0.0
a=25,  b=5,   rating= -0.5
a=0,   b=100, rating= -1

but for others not, for example shoots on target. It doesn't take into account the proportions.
My problem is, the rating of the a=2 b=0 is the same as the a=15 b=0 , but on the pitch this is a big difference between two teams.

I would really appreciate if you could help me to find out which formula would fit for this problem.

Thanks in advance!




--this is not related to the question, just information if you are interested:
I want to use weighted average for the statistics, because some of them are more important than others. eg: dangerous attack(within 35 meters of the opponent's goal line) > attack (around the center if the pitch)

You can find coefficient variation that is the ratio of standard deviation and mean.

double getVariance(int a, int b) {
    double mean = (a+b)/2;
    double temp = (a-mean)*(a-mean) + (b-mean)*(b-mean);
    return temp;
}

The lower the result value, the more homogeneous the data is. You can use this to give a 'weight' to your results.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM