Skip to main content
. 2023 Jun 26;10(7):766. doi: 10.3390/bioengineering10070766
 Algorithm 2: Novel Gini index Algorithm.

1 function GiniSplit (Features,labels,length(X+y));

   Input   : features, labels, length(X + y)

   Output: gini split, cutoff value, length(X + y)

2 sorted ← Sort Features

  labelstotal ← y[sorted]

  0belowcutoff ← findall0labelsbelowsplitpoint

  1belowcutoff ← findall1labelsbelowsplitpoint

  0abovecutoff ← totalsumof0labels−0belowcutoff

  1abovecutoff ← totalsumof1labels−1belowcutoff

  ginibelow ← multiplyratiosoftwobelowlabels

  giniabove ← multiplyratiosoftwoabovelabels

  InitialGinisplit ← add giniabove and ginibelow

  Ginisplit ← findmingini’sfromInitialGinisplit

  cutoffindex ← InitialGinisplit[Ginisplit]

  cutoff value ← X[cutoffindex,length(X+y)]

 

3 return Ginisplit, cutoff value, length(X+y)