コード例 #1
0
 def __init__(self, breaks, densities, bin_repr_points, scope=None, type_=None, meta_type=MetaType.DISCRETE):
     Leaf.__init__(self, scope=scope)
     self.type = type(self).type if not type_ else type_
     self.meta_type = meta_type
     self.breaks = breaks
     self.densities = densities
     self.bin_repr_points = bin_repr_points
コード例 #2
0
    def __init__(self, scope=None, data=None):
        self._type = Type.BINARY
        Leaf.__init__(self, scope=scope)

        assert data is not None

        self.n_features = data.shape[1]
コード例 #3
0
    def __init__(self, x_range, y_range, bin_repr_points, scope=None):
        Leaf.__init__(self, scope=scope)
        self._type = type
        self.x_range = x_range
        self.y_range = y_range

        self.bin_repr_points = bin_repr_points
コード例 #4
0
    def __init__(self,
                 unique_vals,
                 mean,
                 inverted_mean,
                 square_mean,
                 inverted_square_mean,
                 prob_sum,
                 null_value_prob,
                 scope=None):
        """
        Instead of histogram remember individual values.
        :param unique_vals: all possible values in leaf
        :param mean: mean of not null values
        :param inverted_mean: inverted mean of not null values
        :param square_mean: mean of squared not null values
        :param inverted_square_mean: mean of 1/squared not null values
        :param prob_sum: cumulative sum of probabilities
        :param null_value_prob: proportion of null values in the leaf
        :param scope:
        """
        Leaf.__init__(self, scope=scope)
        self.unique_vals = unique_vals

        self.mean = mean
        self.inverted_mean = inverted_mean
        self.square_mean = square_mean
        self.inverted_square_mean = inverted_square_mean
        self.prob_sum = prob_sum
        # ok, err = is_valid_prob_sum(self, self.unique_vals, n.cardinality)
        # assert ok, err
        self.null_value_prob = null_value_prob
コード例 #5
0
 def __init__(self,
              breaks,
              densities,
              bin_repr_points,
              scope=None,
              meta_type=MetaType.REAL):
     Leaf.__init__(self, scope=scope)
     self.meta_type = meta_type
     self.breaks = breaks
     self.densities = densities
     self.bin_repr_points = bin_repr_points
コード例 #6
0
    def __init__(self,
                 unique_vals,
                 probabilities,
                 null_value,
                 scope,
                 cardinality=0):
        """
        Instead of histogram remember individual values.
        :param unique_vals: all possible values in leaf
        :param mean: mean of not null values
        :param inverted_mean: inverted mean of not null values
        :param square_mean: mean of squared not null values
        :param inverted_square_mean: mean of 1/squared not null values
        :param prob_sum: cumulative sum of probabilities
        :param null_value_prob: proportion of null values in the leaf
        :param scope:
        """
        Leaf.__init__(self, scope=scope)
        if not isinstance(unique_vals, np.ndarray):
            unique_vals = np.array(unique_vals)
        self.unique_vals = unique_vals
        self.cardinality = cardinality
        self.null_value = null_value
        self.unique_vals_idx = None
        self.update_unique_vals_idx()

        # will be updated later
        self.prob_sum = None
        self.null_value_prob = None
        self.mean = None
        self.inverted_mean = None
        self.square_mean = None
        self.inverted_square_mean = None

        if not isinstance(probabilities, np.ndarray):
            probabilities = np.array(probabilities)
        self.update_from_new_probabilities(probabilities)
コード例 #7
0
ファイル: Histograms.py プロジェクト: tartaruszen/abda
 def __init__(self, breaks, densities, bin_repr_points, scope=None):
     Leaf.__init__(self, scope=scope)
     self.breaks = breaks
     self.densities = densities
     self.bin_repr_points = bin_repr_points
コード例 #8
0
 def __init__(self, type, scope=None):
     Leaf.__init__(self, scope=scope)
     self._type = type
コード例 #9
0
 def __init__(self, vals, mean, scope=None):
     Leaf.__init__(self, scope=scope)
     self.vals = vals
     self.mean = mean
コード例 #10
0
 def __init__(self, type, scope=None, weights=None, evidence_size=None):
     Leaf.__init__(self, scope=scope)
     self._type = type
     self.evidence_size = evidence_size
     self.weights = weights
コード例 #11
0
 def __init__(self, val, scope=None):
     Leaf.__init__(self, scope=scope)
     self.val = val