def incorporate(self, rowid, observation, inputs=None): DistributionGpm.incorporate(self, rowid, observation, inputs) x = observation[self.outputs[0]] self.N += 1. self.sum_x += x self.sum_x_sq += x * x self.data[rowid] = x
def incorporate(self, rowid, observation, inputs=None): DistributionGpm.incorporate(self, rowid, observation, inputs) x = int(observation[self.outputs[0]]) self.N += 1 if x not in self.counts: self.counts[x] = 0 self.counts[x] += 1 self.data[rowid] = x
def incorporate(self, rowid, observation, inputs=None): DistributionGpm.incorporate(self, rowid, observation, inputs) x = observation[self.outputs[0]] if x < 0: raise ValueError('Invalid Exponential: %s' % str(x)) self.N += 1 self.sum_x += x self.data[rowid] = x
def incorporate(self, rowid, observation, inputs=None): DistributionGpm.incorporate(self, rowid, observation, inputs) x = observation[self.outputs[0]] if x not in [0, 1]: raise ValueError('Invalid Bernoulli: %s' % str(x)) self.N += 1 self.x_sum += x self.data[rowid] = x
def incorporate(self, rowid, observation, inputs=None): DistributionGpm.incorporate(self, rowid, observation, inputs) x = observation[self.outputs[0]] if not (x % 1 == 0 and x >= 0): raise ValueError('Invalid Geometric: %s') % str(x) self.N += 1 self.sum_x += x self.data[rowid] = x
def incorporate(self, rowid, observation, inputs=None): DistributionGpm.incorporate(self, rowid, observation, inputs) x = observation[self.outputs[0]] if not (0 <= x <= 2 * pi): raise ValueError('Invalid Vonmises: %s' % str(x)) self.N += 1 self.sum_sin_x += sin(x) self.sum_cos_x += cos(x) self.data[rowid] = x
def incorporate(self, rowid, observation, inputs=None): DistributionGpm.incorporate(self, rowid, observation, inputs) x = observation[self.outputs[0]] if x <= 0: raise ValueError('Invalid Lognormal: %s' % str(x)) self.N += 1 self.sum_log_x += log(x) self.sum_log_x_sq += log(x) * log(x) self.data[rowid] = x
def incorporate(self, rowid, observation, inputs=None): DistributionGpm.incorporate(self, rowid, observation, inputs) x = observation[self.outputs[0]] if not (x % 1 == 0 and x >= 0): raise ValueError('Invalid Poisson: %s' % str(x)) self.N += 1 self.sum_x += x self.sum_log_fact_x += gammaln(x + 1) self.data[rowid] = x
def incorporate(self, rowid, observation, inputs=None): DistributionGpm.incorporate(self, rowid, observation, inputs) x = observation[self.outputs[0]] if not (x % 1 == 0 and 0 <= x < self.k): raise ValueError('Invalid Categorical(%d): %s' % (self.k, x)) x = int(x) self.N += 1 self.counts[x] += 1 self.data[rowid] = x
def incorporate(self, rowid, observation, inputs=None): DistributionGpm.incorporate(self, rowid, observation, inputs) x = observation[self.outputs[0]] if not (self.l <= x <= self.h): raise ValueError('Invalid NormalTrunc(%f,%f): %s' % (self.l, self.h, str(x))) self.N += 1 self.sum_x += x self.sum_x_sq += x * x self.data[rowid] = x
def incorporate(self, rowid, observation, inputs=None): DistributionGpm.incorporate(self, rowid, observation, inputs) x = observation[self.outputs[0]] if np.allclose(0, x): x = 0.001 elif np.allclose(1, x): x = 0.999 if not 0 < x < 1: raise ValueError('Invalid Beta: %s' % str(x)) self.N += 1 self.sum_log_x += log(x) self.sum_minus_log_x += log(1.-x) self.data[rowid] = x