'Update the node color for classification trees'

def toggle_node_color_cls(self):

    colors = self.scene.colors
    for node in self.scene.nodes():
        distr = node.tree_adapter.get_distribution(node.node_inst)[0]
        total = sum(distr)
        if self.target_class_index:
            p = (distr[(self.target_class_index - 1)] / total)
            color = colors[(self.target_class_index - 1)].lighter((200 - (100 * p)))
        else:
            modus = np.argmax(distr)
            p = (distr[modus] / (total or 1))
            color = colors[int(modus)].lighter((300 - (200 * p)))
        node.backgroundBrush = QBrush(color)
    self.scene.update()
