BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
chemicalab
Fluorite | Level 6

Hi all,

Any ideas on how the gini measure of diversity  is calculated when creating bins through the interactive binning node? cause i see it alters when i either merge or spliit bins

Thank you in advance

1 ACCEPTED SOLUTION

Accepted Solutions
jwexler
SAS Employee

Hi, thanks to one of my R&D colleagues, he wrote up a quick solution using IML, which should match your results in EM.

proc iml;

event={517,365,349,269};

nonevent={233,281,451,535};

sum1=0;

do i=2 to 4;

     sum2=0;

     im1=i-1;

      do j=1 to im1;

sum2=sum2+nonevent;

end;

sum1=sum1 + event*sum2;

end;

sum3=0;

do i=1 to 4;

sum3 = sum3 + event*nonevent;

end;

gini = 100*(1 - (2*sum1 + sum3)/ (1500*1500)) ;

print sum1 sum2 sum3 gini;

quit;


524016

965

524340

30.1168

View solution in original post

4 REPLIES 4
jwexler
SAS Employee

Hi as you may already know, the Gini statistic tests for differences in bin values with respect to the target (events vs non-events).  As Gini changes in the Interactive Binning node, you get an idea of the validity of your bin cutoffs.

You can find this equation in the EM reference guide in the Interactive Binning node section.

gini.png

Thanks,

Jonathan

chemicalab
Fluorite | Level 6

Ok i think i am almost there, but how would the formula look like in the following example?

Value

GroupCutoffEvent countNon event countTotalEvent rate
MISSING1 0000
AGE <25225.551723375068.9%
25.5<AGE<3133136528164656.5%
31.5<AGE<40431.534945180043.6%
40<AGE5 26953580433.5%

Thank you in advance

jwexler
SAS Employee

Hi, thanks to one of my R&D colleagues, he wrote up a quick solution using IML, which should match your results in EM.

proc iml;

event={517,365,349,269};

nonevent={233,281,451,535};

sum1=0;

do i=2 to 4;

     sum2=0;

     im1=i-1;

      do j=1 to im1;

sum2=sum2+nonevent;

end;

sum1=sum1 + event*sum2;

end;

sum3=0;

do i=1 to 4;

sum3 = sum3 + event*nonevent;

end;

gini = 100*(1 - (2*sum1 + sum3)/ (1500*1500)) ;

print sum1 sum2 sum3 gini;

quit;


524016

965

524340

30.1168

chemicalab
Fluorite | Level 6

Thank you very much for your help

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 10713 views
  • 0 likes
  • 2 in conversation