Decision trees like ID3 and C4.5 choose splits by information gain: how much a split reduces label entropy.
Implement:
entropy(labels): Shannon entropy in bits, (0 for an empty or pure set)information_gain(labels, mask): entropy of the parent minus the size-weighted entropy of labels[mask] and labels[~mask]