Gini impurity (local entropy) of a label sequence
(y)
| 229 | |
| 230 | |
| 231 | def gini(y): |
| 232 | """ |
| 233 | Gini impurity (local entropy) of a label sequence |
| 234 | """ |
| 235 | hist = np.bincount(y) |
| 236 | N = np.sum(hist) |
| 237 | return 1 - sum([(i / N) ** 2 for i in hist]) |
nothing calls this directly
no outgoing calls
no test coverage detected