(self, model=None)
Input signal handler
Input signal handler
Input signal handler
def ctree(self, model=None):
        """Input signal handler"""
        self.clear_scene()
        self.color_combo.clear()
        self.closeContext()
        self.model = model
        self.target_class_index = 0
        if model is None:
            self.infolabel.setText('No tree.')
            self.root_node = None
            self.dataset = None
            self.tree_adapter = None
        else:
            self.tree_adapter = self._get_tree_adapter(model)
            self.domain = model.domain
            self.dataset = model.instances
            if self.dataset is not None and self.dataset.domain != self.domain:
                self.clf_dataset = self.dataset.transform(model.domain)
            else:
                self.clf_dataset = self.dataset
            class_var = self.domain.class_var
            self.scene.colors = class_var.palette
            if class_var.is_discrete:
                self.color_label.setText("Target class: ")
                self.color_combo.addItem("None")
                self.color_combo.addItems(self.domain.class_vars[0].values)
                self.color_combo.setCurrentIndex(self.target_class_index)
            else:
                self.color_label.setText("Color by: ")
                self.color_combo.addItems(self.COL_OPTIONS)
                self.color_combo.setCurrentIndex(self.regression_colors)
            self.openContext(self.domain.class_var)
            # self.root_node = self.walkcreate(model.root, None)
            self.root_node = self.walkcreate(self.tree_adapter.root)
            self.infolabel.setText('{} nodes, {} leaves'.format(
                self.tree_adapter.num_nodes,
                len(self.tree_adapter.leaves(self.tree_adapter.root))))
        self.setup_scene()
        self.Outputs.selected_data.send(None)
        self.Outputs.annotated_data.send(create_annotated_table(self.dataset, []))
def ctree ( self , model = None ) : self . clear_scene ( ) self . color_combo . clear ( ) self . closeContext ( ) self . model = model self . target_class_index = 0 if model is None : self . infolabel . setText ( 'No tree.' ) self . root_node = None self . dataset = None self . tree_adapter = None else : self . tree_adapter = self . _get_tree_adapter ( model ) self . domain = model . domain self . dataset = model . instances if self . dataset is not None and self . dataset . domain != self . domain : self . clf_dataset = self . dataset . transform ( model . domain ) else : self . clf_dataset = self . dataset class_var = self . domain . class_var self . scene . colors = class_var . palette if class_var . is_discrete : self . color_label . setText ( "Target class: " ) self . color_combo . addItem ( "None" ) self . color_combo . addItems ( self . domain . class_vars [ 0 ] . values ) self . color_combo . setCurrentIndex ( self . target_class_index ) else : self . color_label . setText ( "Color by: " ) self . color_combo . addItems ( self . COL_OPTIONS ) self . color_combo . setCurrentIndex ( self . regression_colors ) self . openContext ( self . domain . class_var ) # self.root_node = self.walkcreate(model.root, None) self . root_node = self . walkcreate ( self . tree_adapter . root ) self . infolabel . setText ( '{} nodes, {} leaves' . format ( self . tree_adapter . num_nodes , len ( self . tree_adapter . leaves ( self . tree_adapter . root ) ) ) ) self . setup_scene ( ) self . Outputs . selected_data . send ( None ) self . Outputs . annotated_data . send ( create_annotated_table ( self . dataset , [ ] ) )