Exemple #1
0
 def init(self, shared, group=None):
     if group is None:
         self.p = sample_beta(shared.alpha, shared.beta)
     else:
         alpha = shared.alpha + group.heads
         beta = shared.beta + group.tails
         self.p = sample_beta(alpha, beta)
Exemple #2
0
 def init(self, shared, group=None):
     if group is None:
         self.p = sample_beta(shared.alpha, shared.beta)
     else:
         alpha = shared.alpha + group.heads
         beta = shared.beta + group.tails
         self.p = sample_beta(alpha, beta)
Exemple #3
0
 def add_value(self, value):
     assert value != OTHER, 'cannot add OTHER'
     count = self.counts.get(value, 0) + 1
     self.counts[value] = count
     if count == 1:
         beta = self.beta0 * sample_beta(1.0, self.gamma)
         self.beta0 = max(0.0, self.beta0 - beta)
         self.betas[value] = beta
Exemple #4
0
 def add_value(self, value):
     assert value != OTHER, 'cannot add OTHER'
     count = self.counts.get(value, 0) + 1
     self.counts[value] = count
     if count == 1:
         beta = self.beta0 * sample_beta(1.0, self.gamma)
         self.beta0 = max(0.0, self.beta0 - beta)
         self.betas[value] = beta
 def init(self, shared, group=None):
     post = shared if group is None else shared.plus_group(group)
     self.p = sample_beta(post.alpha, post.beta)
Exemple #6
0
 def init(self, shared, group=None):
     post = shared if group is None else shared.plus_group(group)
     self.p = sample_beta(post.alpha, post.beta)
Exemple #7
0
 def init(self, shared):
     self.heads = 0
     self.tails = 0
     self.p = sample_beta(shared.alpha, shared.beta)
Exemple #8
0
 def init(self, shared, group=None):
     if group is None:
         self.p = sample_beta(shared.alpha, shared.beta)
     else:
         self.p = group.p
Exemple #9
0
 def init(self, shared):
     self.heads = 0
     self.tails = 0
     self.p = sample_beta(shared.alpha, shared.beta)
Exemple #10
0
 def init(self, shared, group=None):
     if group is None:
         self.p = sample_beta(shared.alpha, shared.beta)
     else:
         self.p = group.p