Exemple #1
0
 def update(self, att_val, class_val, weight):
     if utils.is_missing_value(att_val):
         self._missing_weight += weight
     else:
         val_dist = self._class_lookup.get(class_val, None)
         if val_dist is None:
             val_dist = ValueDistribution()
             val_dist.add(att_val, weight)
             self._class_lookup[class_val] = val_dist
         else:
             val_dist.add(att_val, weight)
     self._total_weight += weight
 def update(self, att_val, class_val, weight):
     if utils.is_missing_value(att_val):
         self._missing_weight += weight
     else:
         val_dist = self._class_lookup.get(class_val, None)
         if val_dist is None:
             val_dist = ValueDistribution()
             val_dist.add(att_val, weight)
             self._class_lookup[class_val] = val_dist
         else:
             val_dist.add(att_val, weight)
     self._total_weight += weight
    def update(self, att_val, class_val, weight):
        """Update the statistics with the supplied attribute and class values.

        Args:
            att_val (float): The value of the attribute.
            class_val (str): The value of the class.
            weight (float): The weight of this observation.
        """
        if not utils.is_missing_value(att_val):
            norm = self._class_lookup.get(class_val, None)
            if norm is None:
                norm = GaussianEstimator()
                self._class_lookup[class_val] = norm
                self._min_val_observed_per_class[class_val] = att_val
                self._max_val_observed_per_class[class_val] = att_val
            else:
                if att_val < self._min_val_observed_per_class[class_val]:
                    self._min_val_observed_per_class[class_val] = att_val
                if att_val > self._max_val_observed_per_class[class_val]:
                    self._max_val_observed_per_class[class_val] = att_val
            norm.add_value(att_val, weight)
    def update(self, att_val, class_val, weight):
        """Update the statistics with the supplied attribute and class values.

        Args:
            att_val (float): The value of the attribute.
            class_val (str): The value of the class.
            weight (float): The weight of this observation.
        """
        if not utils.is_missing_value(att_val):
            norm = self._class_lookup.get(class_val, None)
            if norm is None:
                norm = GaussianEstimator()
                self._class_lookup[class_val] = norm
                self._min_val_observed_per_class[class_val] = att_val
                self._max_val_observed_per_class[class_val] = att_val
            else:
                if att_val < self._min_val_observed_per_class[class_val]:
                    self._min_val_observed_per_class[class_val] = att_val
                if att_val > self._max_val_observed_per_class[class_val]:
                    self._max_val_observed_per_class[class_val] = att_val
            norm.add_value(att_val, weight)