(self, data, active_inst, level=1)
return node
Induce a tree from the given data

        Returns:
            root node (Node)
Induce a tree from the given data
Induce a tree from the given data
def _build_tree(self, data, active_inst, level=1):
        """Induce a tree from the given data

        Returns:
            root node (Node)"""
        node_insts = data[active_inst]
        if len(node_insts) < self.min_samples_leaf:
            return None
        if len(node_insts) < self.min_samples_split or \
                self.max_depth is not None and level > self.max_depth:
            node, branches, n_children = Node(None, None, None), None, 0
        else:
            node, branches, n_children = self._select_attr(node_insts)
        mean, var = np.mean(node_insts.Y), np.var(node_insts.Y)
        node.value = np.array([mean, 1 if np.isnan(var) else var])
        node.subset = active_inst
        if branches is not None:
            node.children = [
                self._build_tree(data, active_inst[branches == br], level + 1)
                for br in range(n_children)]
        return node
def _build_tree ( self , data , active_inst , level = 1 ) : node_insts = data [ active_inst ] if len ( node_insts ) < self . min_samples_leaf : return None if len ( node_insts ) < self . min_samples_split or self . max_depth is not None and level > self . max_depth : node , branches , n_children = Node ( None , None , None ) , None , 0 else : node , branches , n_children = self . _select_attr ( node_insts ) mean , var = np . mean ( node_insts . Y ) , np . var ( node_insts . Y ) node . value = np . array ( [ mean , 1 if np . isnan ( var ) else var ] ) node . subset = active_inst if branches is not None : node . children = [ self . _build_tree ( data , active_inst [ branches == br ] , level + 1 ) for br in range ( n_children ) ] return node