示例#1
0
 def wrap(tree, i):
     t = SklTreeClassifier(tree)
     t.domain = self.domain
     t.supports_multiclass = self.supports_multiclass
     t.name = "{} - tree {}".format(self.name, i)
     t.original_domain = self.original_domain
     return t
示例#2
0
    def commit(self):
        """Commit the selected tree to output."""
        if len(self.scene.selectedItems()) == 0:
            self.send('Tree', None)
            # The selected tree index should only reset when model changes
            if self.model is None:
                self.selected_tree_index = -1
            return

        selected_item = self.scene.selectedItems()[0]
        self.selected_tree_index = self.grid_items.index(selected_item)
        tree = self.model.skl_model.estimators_[self.selected_tree_index]

        if self.forest_type == self.CLASSIFICATION:
            obj = SklTreeClassifier(tree)
        else:
            obj = SklTreeRegressor(tree)
        obj.domain = self.model.domain
        obj.instances = self.model.instances

        obj.meta_target_class_index = self.target_class_index
        obj.meta_size_calc_idx = self.size_calc_idx
        obj.meta_size_log_scale = self.size_log_scale
        obj.meta_depth_limit = self.depth_limit

        self.send('Tree', obj)
    def commit(self):
        """Commit the selected tree to output."""
        if len(self.scene.selectedItems()) == 0:
            self.send('Tree', None)
            # The selected tree index should only reset when model changes
            if self.model is None:
                self.selected_tree_index = -1
            return

        selected_item = self.scene.selectedItems()[0]
        self.selected_tree_index = self.grid_items.index(selected_item)
        tree = self.model.skl_model.estimators_[self.selected_tree_index]

        if self.forest_type == self.CLASSIFICATION:
            obj = SklTreeClassifier(tree)
        else:
            obj = SklTreeRegressor(tree)
        obj.domain = self.model.domain
        obj.instances = self.model.instances

        obj.meta_target_class_index = self.target_class_index
        obj.meta_size_calc_idx = self.size_calc_idx
        obj.meta_size_log_scale = self.size_log_scale
        obj.meta_depth_limit = self.depth_limit

        self.send('Tree', obj)
示例#4
0
 def wrap(tree, i):
     t = SklTreeClassifier(tree)
     t.domain = self.domain
     t.supports_multiclass = self.supports_multiclass
     t.name = "{} - tree {}".format(self.name, i)
     t.original_domain = self.original_domain
     if hasattr(self, 'instances'):
         t.instances = self.instances
     return t
示例#5
0
 def wrap(tree, i):
     t = SklTreeClassifier(tree)
     t.domain = self.domain
     t.supports_multiclass = self.supports_multiclass
     t.name = "{} - tree {}".format(self.name, i)
     t.original_domain = self.original_domain
     return t
示例#6
0
 def wrap(tree, i):
     t = SklTreeClassifier(tree)
     t.domain = self.domain
     t.supports_multiclass = self.supports_multiclass
     t.name = "{} - tree {}".format(self.name, i)
     t.original_domain = self.original_domain
     if hasattr(self, 'instances'):
         t.instances = self.instances
     return t