4 hidden checks
Implement the impurity measure and the split search a decision tree runs at every node.
gini(y): the Gini impurity of an array of integer class labels. Return 0.0 for an empty array.best_split(x, y): for one featurexand labelsy, return(threshold, score): the thresholdtthat minimises the weighted Gini of the two sidesx < tandx >= t, and that weighted Gini. Only consider thresholds that put at least one example on each side; candidate thresholds are the unique values ofx.
- gini of pure, balanced and empty nodesnot run
- best_split separates a clean 1-D datasetnot run
- best_split finds the classic iris splitnot run
- best_split never leaves a side emptynot run