Questions tagged [gini]

The Gini coefficient (also known as the Gini index or Gini ratio) (/dʒini/ jee-nee) is a measure of statistical dispersion intended to represent the income distribution of a nation's residents, and is the most commonly used measure of inequality.

The Gini coefficient (also known as the Gini index or Gini ratio) (/dʒini/ jee-nee) is a measure of statistical dispersion intended to represent the income distribution of a nation's residents, and is the most commonly used measure of inequality.

72 questions
0
votes
1 answer

Weighted Gini coefficient in Python

Here's a simple implementation of the Gini coefficient in Python, from https://stackoverflow.com/a/39513799/1840471: def gini(x): # Mean absolute difference. mad = np.abs(np.subtract.outer(x, x)).mean() # Relative mean absolute…
Max Ghenis
  • 14,783
  • 16
  • 84
  • 132
0
votes
1 answer

Gini coefficient with keras in python

I want to calculate simple NN model with gini coefficient as its optimizer function. Here is the my gini function: def gini(actual, pred): nT = K.shape(actual)[-1] n = K.cast(nT, dtype='int32') inds = K.reverse(tf.nn.top_k(pred, n)[1],…
Gregorius Edwadr
  • 399
  • 1
  • 3
  • 14
0
votes
1 answer

Gini Index in R

I am trying to calculate the Gini index for each row of my database. Each row is a customer and each column is a monthly session. So what i need to do is to add a column with the Gini index by row, for each customer throughout the 12 months. See…
0
votes
0 answers

How can variable importance / mean decrease in Gini be >.5?

I'm currently working on a project in which I use Random Forest. I want to know the feature importance of all covariates and want to use MeanDecreaseGini for this. I really don't understand why there can be values greater than 0.5. The Gini index…
TobiSonne
  • 1,044
  • 7
  • 22
0
votes
1 answer

Rpart split error: Agument split not matched

I want to change the splitting method in rpart function from "gini" (which is default) to "information". In the help section we have this example: fit2 <- rpart(Kyphosis ~ Age + Number + Start, data = kyphosis, parms = list(prior =…
itsame
  • 1
  • 1
0
votes
1 answer

SAS Code - Trying to understand how to build GINI Index

I am participating in a data science competition and my final predictions would be measured via a GINI Index. It is a regression problem. I have the source code for the calculation in SAS but I dont know SAS and am not able to understand what is…
nEO
  • 5,305
  • 3
  • 21
  • 25
0
votes
1 answer

How to create for loop to calculate gini function for binned data in r?

I'm having some difficulties trying to calculate the gini coefficient using binned census data, and would really appreciate any help. My data looks a little something like this (but with 14,000 observations of 13 variables). location <-…
Sarlo
  • 3
  • 4
-1
votes
1 answer

what is the range of gini impurity when more than 2 classes?

when we are building a decisiontree, we are usually calculating the gini impurity at each node. I am interested to see the range of gini impurity in case of more than 2 classes. Because entropy always have range=[0,1], irrespective of number of…
-1
votes
1 answer

Blau index of Diversity in R

I am trying to calculate the Blau index of diversity (gini-simpson) in R on my data frame. I have 6 columns for each person in a group, with values ranging from "Student", "Faculty", "Alumni" "Not Applicable". There are also NA's within the columns…
-1
votes
1 answer

Survey design issues in convey package

I have some issue, potentially simple but I failed to figure out by far. So I have a survey design as follows: design1 = svrepdesign( weights=~W10, repweights=W, data = imputationList(list(imp1, imp2, imp3, imp4, imp5)), scale = 1, …
Rom
  • 25
  • 6
-1
votes
2 answers

SQL syntax for complex GROUP BY with OVER statement: calculating Gini coefficient for multiple sets

I want to calculate the Gini coefficient for a number of sets, containing in a two-column table (here called #cits) containing a value and a set-ID. I have been experimenting with different Gini-coefficient calculations, described here…
ipoga
  • 394
  • 2
  • 12
-1
votes
1 answer

Stata: for loop for storing values of Gini coefficient

I have 133 variables on income (each variable represents a group). I want the Gini coefficients of all these groups, so I use ineqdeco in Stata. I can't compute all these coefficients by hand so I created a for loop: gen sgini = . foreach var of…
pk_22
  • 288
  • 1
  • 2
  • 18
1 2 3 4
5