Example #1
0
 def initialize(self, M, K, R):
     self.M = M
     self.K = K
     self.R = R
     for m in range(1, self.M + 1):
         self.y_list.append(samplable.IntV(0))
     self.y_combination.extend(utils.get_full_combination(self.M, self.K))
     for i in range(1, len(self.y_combination)):
         self.y_prob_list.append(samplable.RealV(0.0))
     self.z = samplable.IntV(0)
     for r in range(1, self.R + 1):
         self.z_prob_list.append(samplable.RealV(0.0))
Example #2
0
 def initialize(self, M, K):
     self.M = M
     self.K = K
     for m in range(1, self.M + 1):
         self.y_list.append(samplable.IntV(0))
         probs = numpy.ndarray(shape=(self.K + 1), dtype=samplable.RealV, order='C')
         for i in range(1, self.K + 1):
             probs[i] = samplable.RealV(1.0 / self.K)
         self.y_prob_list.append(probs)
         self.likelihood_list.append(samplable.RealV(0.0))
Example #3
0
 def initialize(self, M, K):
     self.M = M
     self.K = K
     for m in range(1, self.M + 1):
         self.y_list.append(samplable.IntV(0))
         probs = numpy.ndarray(shape=(self.K + 1),
                               dtype=samplable.RealV,
                               order='C')
         r = [numpy.random.random() for i in range(0, self.K)]
         s = sum(r)
         r = [i / s for i in r]
         for i in range(1, self.K + 1):
             probs[i] = samplable.RealV(r[i - 1])
         self.y_prob_list.append(probs)