(self, node)
Update the printed contents of the node for classification trees
Update the printed contents of the node for classification trees
Update the printed contents of the node for classification trees
def update_node_info_cls(self, node):
        """Update the printed contents of the node for classification trees"""
        node_inst = node.node_inst
        distr = self.tree_adapter.get_distribution(node_inst)[0]
        total = self.tree_adapter.num_samples(node_inst)
        distr = distr / np.sum(distr)
        if self.target_class_index:
            tabs = distr[self.target_class_index - 1]
            text = ""
        else:
            modus = np.argmax(distr)
            tabs = distr[modus]
            text = f"<b>{self.domain.class_vars[0].values[int(modus)]}</b><br/>"
        if tabs > 0.999:
            text += f"100%, {total}/{total}"
        else:
            text += f"{100 * tabs:2.1f}%, {int(total * tabs)}/{total}"

        text = self._update_node_info_attr_name(node, text)
        node.setHtml(
            f'<p style="line-height: 120%; margin-bottom: 0">{text}</p>')
def update_node_info_cls ( self , node ) : node_inst = node . node_inst distr = self . tree_adapter . get_distribution ( node_inst ) [ 0 ] total = self . tree_adapter . num_samples ( node_inst ) distr = distr / np . sum ( distr ) if self . target_class_index : tabs = distr [ self . target_class_index - 1 ] text = "" else : modus = np . argmax ( distr ) tabs = distr [ modus ] text = f"<b>{self.domain.class_vars[0].values[int(modus)]}</b><br/>" if tabs > 0.999 : text += f"100%, {total}/{total}" else : text += f"{100 * tabs:2.1f}%, {int(total * tabs)}/{total}" text = self . _update_node_info_attr_name ( node , text ) node . setHtml ( f'<p style="line-height: 120%; margin-bottom: 0">{text}</p>' )