(self, data)
Set the input_data and call reset_to_input
Set the input_data and call reset_to_input
Set the input_data and call reset_to_input
def set_data(self, data):
        """Set the input_data and call reset_to_input"""
        def _check_and_set_data(data):
            self.clear_messages()
            if data and data.is_sparse():
                self.Warning.sparse_not_supported()
                return False
            if data:
                if not data.domain.attributes:
                    self.Warning.no_input_variables()
                    data = None
                elif len(data.domain.attributes) > 2:
                    self.Information.use_first_two()
            self.input_data = data
            self.btResetToInput.setDisabled(data is None)
            return bool(data)

        if not _check_and_set_data(data):
            return

        X = np.array([scale(vals) for vals in data.X[:, :2].T]).T
        try:
            y = next(cls for cls in data.domain.class_vars if cls.is_discrete)
        except StopIteration:
            if data.domain.class_vars:
                self.Warning.continuous_target()
            self.input_classes = ["C1"]
            self.input_colors = None
            y = np.zeros(len(data))
        else:
            self.input_classes = y.values
            self.input_colors = y.palette

            y = data[:, y].Y

        self.input_has_attr2 = len(data.domain.attributes) >= 2
        if not self.input_has_attr2:
            self.input_data = np.column_stack((X, np.zeros(len(data)), y))
        else:
            self.input_data = np.column_stack((X, y))
        self.reset_to_input()
        self.commit.now()
def set_data ( self , data ) : def _check_and_set_data ( data ) : self . clear_messages ( ) if data and data . is_sparse ( ) : self . Warning . sparse_not_supported ( ) return False if data : if not data . domain . attributes : self . Warning . no_input_variables ( ) data = None elif len ( data . domain . attributes ) > 2 : self . Information . use_first_two ( ) self . input_data = data self . btResetToInput . setDisabled ( data is None ) return bool ( data ) if not _check_and_set_data ( data ) : return X = np . array ( [ scale ( vals ) for vals in data . X [ : , : 2 ] . T ] ) . T try : y = next ( cls for cls in data . domain . class_vars if cls . is_discrete ) except StopIteration : if data . domain . class_vars : self . Warning . continuous_target ( ) self . input_classes = [ "C1" ] self . input_colors = None y = np . zeros ( len ( data ) ) else : self . input_classes = y . values self . input_colors = y . palette y = data [ : , y ] . Y self . input_has_attr2 = len ( data . domain . attributes ) >= 2 if not self . input_has_attr2 : self . input_data = np . column_stack ( ( X , np . zeros ( len ( data ) ) , y ) ) else : self . input_data = np . column_stack ( ( X , y ) ) self . reset_to_input ( ) self . commit . now ( )