calculating gini index

I want to what type of Gini coeffcient used in item distribution and what is the formula to calculate Gini coeffcient and Gini index
Best Answers
-
Hi,
the one used in Trees and Weight By Gini can be found here:
Best,
Martin
1 -
Thank you
Is this formula used for clustring kmean evalution?
do you have the formula as mathematical equation?
0 -
Hi,
for clustering its: https://github.com/rapidminer/rapidminer-studio/blob/master/src/main/java/com/rapidminer/operator/validation/clustering/exampledistribution/GiniCoefficient.java
or in code
double sum = 0;
for (int i = 0; i < x.length; i++) {
sum = sum + x[i];
}
double mean = sum / n;
sum = 0;
for (int i = 0; i < x.length; i++) {
for (int j = 0; j < x.length; j++) {
sum = sum + Math.abs(x[i] - x[j]);
}
}
if (mean == 0) {
return 0.0;
}
return 1 - (sum / (2 * mean * (n * ((double) n - 1))));Best,
Martin
1
Answers
-
Hi,
the one used in Trees and Weight By Gini can be found here:
Best,
Martin
1 -
Thank you
Is this formula used for clustring kmean evalution?
do you have the formula as mathematical equation?
0 -
Hi,
for clustering its: https://github.com/rapidminer/rapidminer-studio/blob/master/src/main/java/com/rapidminer/operator/validation/clustering/exampledistribution/GiniCoefficient.java
or in code
double sum = 0;
for (int i = 0; i < x.length; i++) {
sum = sum + x[i];
}
double mean = sum / n;
sum = 0;
for (int i = 0; i < x.length; i++) {
for (int j = 0; j < x.length; j++) {
sum = sum + Math.abs(x[i] - x[j]);
}
}
if (mean == 0) {
return 0.0;
}
return 1 - (sum / (2 * mean * (n * ((double) n - 1))));Best,
Martin
1