Esempio n. 1
0
    def set_data(self, data, skip_if_same=False, no_data=False):
        if skip_if_same and checksum(data) == checksum(self.data):
            return
        self._reset_data()
        if data is None:
            return

        self.domain = data.domain
        self.data = data
        self.attribute_flip_info = {}
        if not no_data:
            self._compute_domain_data_stat()
            self._compute_scaled_data()
            self._compute_jittered_data()
Esempio n. 2
0
    def set_data(self, data, skip_if_same=False, no_data=False):
        if skip_if_same and checksum(data) == checksum(self.data):
            return
        self._reset_data()
        if data is None:
            return

        self.domain = data.domain
        self.data = data
        self.attribute_flip_info = {}
        if not no_data:
            self._compute_domain_data_stat()
            self._compute_scaled_data()
            self._compute_jittered_data()
Esempio n. 3
0
    def set_data(self, data):
        if type(data) == SqlTable and data.approx_len() > LARGE_TABLE:
            data = data.sample_time(DEFAULT_SAMPLE_TIME)

        if data and (not bool(data) or len(data.domain) == 0):
            data = None
        if checksum(data) == checksum(self.data):
            return # check if the new data set is the same as the old one

        self.__ignore_updates = True
        self.closeContext()
        same_domain = self.data and data and data.domain.checksum() == self.data.domain.checksum() # preserve attribute choice if the domain is the same
        self.data = data

        if not same_domain:
            self.shown_attributes = None

        self.openContext(self.data)
        self.__ignore_updates = False
Esempio n. 4
0
    def set_data(self, data):
        if type(data) == SqlTable and data.approx_len() > LARGE_TABLE:
            data = data.sample_time(DEFAULT_SAMPLE_TIME)

        if data and (not bool(data) or len(data.domain) == 0):
            data = None
        if checksum(data) == checksum(self.data):
            return # check if the new data set is the same as the old one

        self.__ignore_updates = True
        self.closeContext()
        same_domain = self.data and data and data.domain.checksum() == self.data.domain.checksum() # preserve attribute choice if the domain is the same
        self.data = data

        if not same_domain:
            self.shown_attributes = None

        self.openContext(self.data)
        self.__ignore_updates = False
Esempio n. 5
0
    def set_data(self, data, skip_if_same=False, no_data=False):
        if skip_if_same and checksum(data) == checksum(self.data):
            return
        self._reset_data()
        if data is None:
            return

        domain = data.domain
        new_domain = Domain(attributes=domain.attributes,
                            class_vars=domain.class_vars,
                            metas=tuple(v for v in domain.metas if v.is_primitive()))
        self.data = data.transform(new_domain)
        self.data.metas = self.data.metas.astype(float)
        self.domain = self.data.domain
        self.attribute_flip_info = {}
        if not no_data:
            self._compute_domain_data_stat()
            self._compute_scaled_data()
            self._compute_jittered_data()
Esempio n. 6
0
    def set_data(self, data, skip_if_same=False, no_data=False):
        if skip_if_same and checksum(data) == checksum(self.data):
            return
        self._reset_data()
        if data is None:
            return

        domain = data.domain
        new_domain = Domain(attributes=domain.attributes,
                            class_vars=domain.class_vars,
                            metas=tuple(v for v in domain.metas
                                        if v.is_primitive()))
        self.data = data.transform(new_domain)
        self.data.metas = self.data.metas.astype(float)
        self.domain = self.data.domain
        self.attribute_flip_info = {}
        if not no_data:
            self._compute_domain_data_stat()
            self._compute_scaled_data()
            self._compute_jittered_data()