func (self *DecisionTree) Train(inputLog il.Interface, targetKey string) { nextKey := inputLog.MaxEntropy(targetKey) if nextKey != targetKey { leftInputLog, rightInputLog := inputLog.SplitOnKey(nextKey) left, right := New(), New() if leftInputLog.Any() { left.Train(leftInputLog, targetKey) } if rightInputLog.Any() { right.Train(rightInputLog, targetKey) } self.InsertLeft(left) self.InsertRight(right) self.Set(nextKey) } else { present := inputLog.KeyCount(targetKey) absent := inputLog.Len() - present self.Set(present > absent) } }