'Calculates information gain ratio for the features in the training data.
Constructs the search tree.'

def _train(self):

    m = Model((Document(set(v), type=type) for (type, v) in self._vectors), weight=BINARY)
    f = sorted(m.features, key=getattr(m, self._method), reverse=True)
    sys.setrecursionlimit(max((len(f) * 2), 1000))
    self._root = self._tree([(v, type) for (type, v) in self._vectors], features=f)
